Posted By:
31 Mar, 2013 7:25 am PDT

Use bisection method to find a root where function is maximum or minimum in matalb

I have a function y = w0/(120EIL) [-x^5 + 2L^2 x^3 - L^4 x],

where L = 600 cm, E = 50,000, I = 30,000, and w0 = 2.5.


I want to use bisection method to determine the point x where dy/dx = 0. My starting interval is [0, L]

Attachment:None


 
L=600; E=50000; I=30000; w0=2.5;
%derivative of a function
f = @(x) w0/(120*E*I*L)*(-5*x.^4+6*L^2*x.^2-L^4);

xl=0;
xu=600;
%loop to execute bisection method
while xu-xl>1e-4
    xm = (xu+xl)/2; %compute xm

    if f(xm)==0 %found the rood exactly!
        break
    elseif f(xm)*f(xl)<0 %root is left of xm
        xu=xm;
    else %root is right of xm
        xl=xm;
    end
end

xm=(xu+xl)/2;
w0/(120*E*I*L)*(-xm.^5+2*L^2*xm.^3-L^4*xm);

%output
% xm = 268.3282
 

 Please see the video and file for details

Attachment: bisection_EIL.m
Was it useful?  




Please login to reply to this problem.



Related Problems on Fixoncloud