transcend3

transcend3 - %Move all terms to one side --> x^4...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
%numerical solutions to equations clear; fprintf('\nThis program solves the equation '); fprintf('x^4 = x + 2\n' ); % We need to know approximately where our solution lies. % From plotting the left-hand side (LHS) and the right- % hand side(RHS) vs. x, I can see that I will have 2 % solutions, 1 between -2 and 0, and 1 between % 0 and 2 xmin = -2; xmax = 0; intv = .001; x1 = xmin : intv : xmax;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %Move all terms to one side --> x^4 - x - 2 = 0 func1 = x1.^4 - x1 - 2; %x value that makes function closest to zero is solution [sol1 index1] = min(abs(func1)); %find other solution, between x = 0 and x = 2 x2 = 0:.001:2; func2 = x2.^4 - x2 - 2; [sol2 index2] = min(abs(func2)); fprintf('\nx= %.2f or x = %.2f\n\n', x1(index1), x2(index2));...
View Full Document

This note was uploaded on 08/06/2010 for the course ENGR 3 taught by Professor Ben-yaakov during the Summer '08 term at UCSB.

Ask a homework question - tutors are online