How to use the shooting method in matlab The governing differential equation for
ID: 3782124 • Letter: H
Question
How to use the shooting method in matlab The governing differential equation for the deflection of a cantilever beam subjected to a point load at its free end (Fig. 1) is given by: EI_zz d^2 y/dx^2 = -Px where E is classic modulus, is beam moment of inertia, y is beam deflection, P is the point load, and x is the distance along the beam measured from the free end. The boundary conditions arc the deflection y (L) is zero and the slope (dy/dr) at x=L is zero, where L is beam length. Solve for the deflection of the beam using the shooting method. Use 1=2 m, /77= 0.0005 m4, P= 10 kN, and E= 200,000 MPa. Provide a plot comparing your results against the analytical solution given by: y(x) = - P/6 EI_zz (L - x)^2 (2L + x)Explanation / Answer
function [x y] = shooting_method(fun,h,zero,a,b,con,type,init) tic; if (h 0) error('The root of F function does not exist, for selected initialization parameters. Please, change the init array.') end F3 = F1; while (abs(F3) > zero) shoot3 = (shoot1 + shoot2)/2; if (type(1)=='f') a3 = [con(1) shoot3]; else a3 = [shoot3 con(1)]; end [x, F3] = RungeKutta(a,b,h,a3,fun); y = F3; F3 = F3(r,end) - con(2); if (F1*F3 < 0) shoot2 = shoot3; F2 = F3; elseif (F1*F2 < 0) shoot1 = shoot3; F1 = F3; else error('Selhani metody puleni intervalu, zmente init'); end end h = plot(x,y(1,:),'k-'); set(h,'linewidth',2); hold on; h = plot(x,y(2,:),'r-'); set(h,'linewidth',2); xlabel('{it x}','FontSize',12); ylabel('y({it x }), y^{(1)}({it x })','FontSize',12); title('Solution of 1D Boundary Value Problem by Shooting Method','FontSize',12); set(gca,'FontSize',12); legend('Function','{1^{st}} Derivative','Location','Best'); hold off; toc;Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.