second order ODE fun. with polynomial and loop
Afficher commentaires plus anciens
x''=(W/M)+((c*x')/M)+((K*(x*cosd((Thet1))-(Cr+(Hd*(sind((180)/((ph)*(Thet1))))))).^3/2 *(cos(Thet1)))/M)
this is the equation to solve
Di=0.0321;
Do=54.67*10^-3;
D=43.385*10^-3;
d=11.274*10^-3;
z=7;
Cr=11.285*10^-6;
M=3;
c=200;
Om=125.66;
Oc=46.5;
h=37*10^-6;
x0=10^-9;
x'0=10^-9;
ph=0.4623;
W=100;
K=8.37536*10^9;
Pi=3.14;
x(1)=x0; v(1)=v0;
j=1; tt=1;
Hd=0.1*10^-3;
for t=0:h:0.7
for i=1:7;
Thet=((46.5)*t)+(((7-i)*(2*3.14)/7)) ;
Thet2=(Thet*180)/3.14;
if (Thet2<=360)
Thet1=Thet2;
elseif (360<=Thet2)&&(Thet2<=720)
Thet1=Thet2-360;
elseif (720<=Thet2)&&(Thet2<=1080)
Thet1=Thet2-720;
elseif (1080<=Thet2)&&(Thet2<=1440)
Thet1=Thet2-1080;
elseif (1440<=Thet2)&&(Thet2<=1800)
Thet1=Thet2-1440;
elseif (1800<=Thet2)&&(Thet2<=2160)
Thet1=Thet2-1800;
elseif (2160<=Thet2)&&(Thet2<=2520)
Thet1=Thet2-2160;
elseif (2520<=Thet2)&&(Thet2<=2880)
Thet1=Thet2-2520;
else
Thet1=Thet2-2880;
end
if (0<=Thet1)&&(Thet1<=0.4623)
%Fx(j)=K*(x*cosd((Thet1))-(Cr+(Hd*(sind((180)/((ph)*(Thet1))))))).^3/2 *(cos(Thet1));
y0=[10^-9;10^-9];
[t,y]=ode45('line',[t t+h],y0);
else
% Fx(j)=0; cosd(Thet1);
end
j=j+1;
end
function fx=line(t,y)
Cr=11.285*10^-6;
c=200;
ph=0.4623;
W=100;
K=8.37536*10^9;
Hd=0.1*10^-3;
fx=zeros(2,1);
fx(1)=y(2);
fx(2)=((33.34)+(66.67*y(2))+((2.791*10^9*(y(1)*cosd((Thet1))-(Cr+(Hd*(sind((180)/((ph)*(Thet1))))))).^3/2 *(cos(Thet1))))); pls tell me how to solve this equation
2 commentaires
Note,
if 5<thet<10
will not function in MATLAB code as expected. It should be
if 5<thet & thet<10
Star Strider
le 5 Mai 2014
Please post the code for your entire ODE function, from the function line the the last end statement.
Réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!