transcend4

transcend4 - func2 = tan(x2) - 2 + x2; [sol2 index2] =...

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('tan(x) = 2 - x' ); x = -8:.01:8; plot(x, tan(x), x, 2-x); axis([-8 8 -15 15]); x1 = -4 : .001: 0 ; func1 = tan(x1) - 2 + x1; [sol1 index1] = min(abs(func1)); x2 = 0 : .001: 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: func2 = tan(x2) - 2 + x2; [sol2 index2] = min(abs(func2)); x3 = 2 : .001: 4 ; func3 = tan(x3) - 2 + x3; [sol3 index3] = min(abs(func3)); fprintf('\nx= %.2f or x = %.2f or x = %.2f\n\n', x1(index1), x2(index2), x3(index3));...
View Full Document

Ask a homework question - tutors are online