function sol = Fig1
solinit=bvpinit(linspace(0,30,50),@guess);
sol=bvp4c(@cantileverode,@cantileverbc,solinit);
xint=linspace(0,30,50);
Sxint=deval(sol,xint);
axis('auto')
function dy=cantileverode(x,y,l,F)
l=17.6e-3; F=0.026; dy=zeros(4,1); dy(1)=y(2); dy(2)=y(3); dy(3)=y(4); dy(4)=(1/l^2)*(y(3)+F*cos(y(1)));function res=cantileverbc(ya,yb,l,F) res=[ya(1) ya(2) yb(3) yb(4)];
function v =guess(x)
v=[(30-x)^4*x^2*exp(x);-4*(30-x)^3*x^2*exp(x)+(30-x)^4*(x^2*exp(x)+2*x*exp(x))];
and the errors are as follows;
Attempted to access y(3); index out of bounds because numel(y)=2.
Error in Fig1>cantileverode (line 10) dy(2)=y(3);
Error in bvparguments (line 105) testODE = ode(x1,y1,odeExtras{:});
Error in bvp4c (line 129) [n,npar,nregions,atol,rtol,Nmax,xyVectorized,printstats] = …
Error in Fig1 (line 3) sol=bvp4c(@cantileverode,@cantileverbc,solinit);
Best Answer