second order ODE fun. with polynomial and loop
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
Star Strider
2014-5-5
Please post the code for your entire ODE function, from the function line the the last end statement.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!