Question

Find the root of f(x) = ex- a. Using incremental search method. b. Using bisection method. c. Compare the processing time of
1 0
Add a comment Improve this question Transcribed image text
Answer #1

Given

f(7) = e - 3x

1)

%incremental search method
f=@(x) exp(x)-3*x;
x0=0;
dx=0.1;
while f(x0+dx)>1e-4
while (f(x0)*f(x0+dx))>0
x0=x0+dx;
end
dx=dx.*0.1;
end
disp(['root of the equation to desired accuracy is x = ' num2str(x0)]);

--------------------------------------------------------

>> m1
root of the equation to desired accuracy is x = 0.619
>>

----------------------------

2)bisection method

f(7) = e - 3x

f(0)=1>0
f(1)=e-3=-0.282<0

therefore

root lies between x=0 and x=1

-------------------------

%bisection method
f=@(x) exp(x)-3*x;
x1=0;
x0=1;
x2=0.5*(x1+x0);
while abs(f(x2))>1e-4;
if f(x2)<0
x0=x2;
else
x1=x2;
end
x2=0.5*(x0+x1);
end
disp(['root of the equation to desired accuracy is x = ' num2str(x2)]);

---------------------------------


>> m4
root of the equation to desired accuracy is x = 0.61914
>>

-----------------------------

Add a comment
Know the answer?
Add Answer to:
Find the root of f(x) = ex- a. Using incremental search method. b. Using bisection method....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT