How can I solve a 4th Order ODE in a loop?

Below code solves 4th order ODE for a particular value of h. I'm intending to get results for h=0.1*l:0.1*l:l (likewise for each h there will be corresponding L i.e L = 5*h). Can anyone help me getting this?
function main
global yright
figure (1);
hold on;
yright=0.0;
P=1e-6;
E=102e9;
l=1*sqrt(2e-8);
m=1*sqrt(5e-9);
h=0.1*l;
L=5*h;
b=2*h;
Es=7.56*1;
A=b*h;
v=0.34;
G=35.5e9;
I=(b*h.^3)/12;
e31=-17.05*1;
e31s=(-3e-8)*1;
a33=1.76e-8*1;
V=2*0;
EIeff=(E+(e31.^2)/a33)*I+((1/2)*(Es+e31*e31s/a33)*b*h.^2)+((1/6)*(Es+e31*e31s/a33)*h.^3);
EIeff_est1=((e31.^2)/a33)*I+((1/2)*(e31*e31s/a33)*b*h.^2)+((1/6)*(Es+e31*e31s/a33)*h.^3);
ee=EIeff/(E*I);
eee=EIeff_est1/(E*I);
% (E+(e31.^2)/k33)*I+((1/2)*(Es+e31*e31s/k33)*b*h^2)+((1/6)*(Es+e31*e31s/k33)*h^3);
alpha=(1/((G*A*EIeff)^0.5));
J =(P.^2)*alpha;
To=-10*1;
H=(2*b*To)/(E*I);
H2=(2*b*To);
T=((e31*V*b)+(2*b*V*e31s/h))/(E*I);
T2=((e31*V*b)+(2*b*V*e31s/h));
F=P/(E*I);% here F is equal to force/(E*I)
F2=P/(E*I);
solinit=bvpinit(linspace(0,L,1000),[0 0 0 0]);
options = bvpset('NMax',1000);
sol1=bvp4c(@(x,y)cantileverode(x,y,l,m,ee,eee,H,T,F,L),@(ya,yb)cantileverbc(ya,yb,l,m,ee,eee,H,T,F,L),solinit,options);
xint=linspace(0,L,100);
Sxint1=deval(sol1,xint);
axis(['auto']);
plot(xint,Sxint1(1,:));
% plot(xint/L,Sxint1(1,:)*2*E*I/(P*L*L));
h = findobj(gca,'Type','line');
x=get(h,'Xdata');
y=get(h,'Ydata');
Dx=trapz(x,cos(y));
Dy=trapz(x,sin(y));
Mo=(H2+T2)*(y(end)*x(end)-trapz(x,y));
U2=(J*Dx^2)+(alpha*Mo^2);
disp(Dy);
disp(U2);
xlabel('Normalized arc length (s/a)')
ylabel('Normalized rotation angle-(Phi/(Fa^2/2EI))')
function dy=cantileverode(x,y,l,m,ee,eee,H,T,F,L)
global yright
dy=[y(2)
y(3)
y(4)
1/(l^2)*((ee*y(3)+F*cos(y(1))-(H+T)*y(1)+(H+T)*yright)+((m^2)*y(4))*eee)];
function res=cantileverbc(ya,yb,l,m,ee,eee,H,T,F,L)
global yright
yright = yb(1);
res=[ya(1)
ya(3)
yb(2)
yb(4)];
Thanks in advance

Answers (0)

This question is closed.

Tags

Asked:

on 1 Nov 2017

Closed:

on 20 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!