transcend2

transcend2 - xmin = 0; xmax = 2; intv = .001; x = xmin :...

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

View Full Document Right Arrow Icon
%numerical solutions to equations fprintf('\nThis program solves the equation '); fprintf('x^2 + 1 = 2x\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 my solution for % x is between 0 and 2
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: xmin = 0; xmax = 2; intv = .001; x = xmin : intv : xmax; %find function at each x point %Move all terms to one side --> x^2 - 2*x + 1 = 0 func = x.^2 - 2*x + 1; %x value that makes function closest to zero is solution [value index] = min(abs(func)); fprintf('\nx= %.2f\n\n', x(index));...
View Full Document

Ask a homework question - tutors are online