Please use Matlab to solve and comment i·m, \"y be output in Macia ing fprintf t
ID: 3670031 • Letter: P
Question
Please use Matlab to solve and comment
Explanation / Answer
a)using bisection method
f=@(x)-5*x.^2-2;
a=0;
b=12.57142;
for i=1:100
c=(a+b)/2;
if f(c)>0
b=c;
else
a=c;
end
end
fprintf('Approxinmation Root is %f',c);
b) using newton raphson method:
f=@ 8* sin(x.^2-2)
df=@(x)-5*x.^2-2
a=0;b=0;
x=a;
for i=1:1:100
x1=x-(f(x)/df(x));
x=x1;
end
sol=x;
fprintf('Approximate Root is %f',sol)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.