The code is written as follows;
function main
figure (1); hold on;
l=17.6e-6;
P=1e-6;
E=1.44e9;
h=0.1*l;
b=2*h;
I=(b*h.^3)/12;
H=(2*b*0.1)/(E*I);
F=P/(E*I);% here F is equal to force/(E*I)
L=20*h;
solinit=bvpinit(linspace(0,L,1000),[0 0 0 0]);
options = bvpset('NMax',1000);
sol1=bvp4c(@(x,y,yb)cantileverode(x,y,yb,l,H,F,L),@(ya,yb)cantileverbc(ya,yb,l,H,F,L),solinit,options);
xint=linspace(0,L,100);
Sxint1=deval(sol1,xint);
axis(['auto']);
plot(xint/L,Sxint1(1,:)/(F*L^2/2));
h = findobj(gca,'Type','line');
x=get(h,'Xdata');
y=get(h,'Ydata');
Dx=trapz(x,cos(y));
Dy=trapz(x,sin(y));
disp(Dx);
disp(Dy);
xlabel('Normalized arc length (s/a)')
ylabel('Normalized rotation angle-(Phi/(Fa^2/2EI))')
function dy=cantileverode(x,y,yb,l,H,F,L)
dy=[y(2)
y(3) y(4) (1/l^2)*(y(3)+F*cos(y(1))+H*y(1)- H*yb(1))];
function res=cantileverbc(ya,yb,l,H,F,L)
res=[ya(1)
ya(3) yb(2) yb(2)-l^2*yb(4)];
The error is given as;
Error using main>@(x,y,yb)cantileverode(x,y,yb,l,H,F,L) (line 14) Not enough input arguments.
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 main (line 14) sol1=bvp4c(@(x,y,yb)cantileverode(x,y,yb,l,H,F,L),@(ya,yb)cantileverbc(ya,yb,l,H,F,L),solinit,options);
The problem according to me is the term yb(1) in the ode.Since, it is suppose to be there, so I am not sure how to deal with it?
Thanks and Regards
Richardson
Best Answer