Please show all work and comment lines that are complicated
Please show all work, and comment lines that are complicated. Please avoid major function commands that skip alot of coding. Must be on MATLab 2015a or higher.
Thanky you =) !!!
Solution
i just have matlab 2013a but this program also run in the matlab 2015a,
program:
clc
clear;
disp(\'x=x^3-x^2\');
x=0.1;%initiation
tol=1;%tolerence
itr=0;
while(tol>0.000001),
xi=x^3-x^2;%function defination
tol=abs(x-xi);%error
x=xi;
itr=itr+1;
end
itr
x
disp(\'x=cos(x)\');
x=0.1;%initiation
tol=1;%tolerence
itr=0;
while(tol>0.000001),
xi=cos(x);%function defination
tol=abs(x-xi);%error
x=xi;
itr=itr+1;
end
itr
x
result:
x=x^3-x^2
itr =
4
x =
-4.4625e-17
x=cos(x)
itr =
35
x =
0.7391
