Question

Write a MATLAB script to solve the nonlinear equation by using the combination of bisection and...

Write a MATLAB script to solve the nonlinear equation by using the combination of bisection and regular-falsi methods. During the iterative process, the numerical solutions are once estimated with regula-falsi and once with bisection method, (odd iterations use regular-falsi, even iterations use bisection). The initial interval for ω is [1 1000]. The threshold for error is Thr=0.01. Display the following: Final solution Number of iteration Absolute relative approximate error

Homework Answers

Answer #1

function p = Bisection(f,a,b)

% Provide the equation you want to solve with R.H.S = 0 form.

f = 600*p^4-550*p^3+200*p^2-20*p-1;

% Write the L.H.S by using inline function

% Give initial guesses.

a=1;

b=2;

% Solves it by method of bisection.

if f(a)*f(b)>0

disp('Choose another guess')

else

p = (a + b)/2;

err = abs(f(p));

while err > 1e-7

if f(a)*f(p)<0

b = p;

else

a = p;

end

p = (a + b)/2;

err = abs(f(p));

end

end

p = (a + b)/2;

err = abs(f(p));

while err > 1e-7

if f(a)*f(p)<0

b = p;

else

a = p;

end

p = (a + b)/2;

err = abs(f(p));

end

end

Know the answer?
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
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT