找回密码
 注册
Simdroid-非首页
查看: 81|回复: 2

解方程结果为NaN?

[复制链接]
发表于 2009-8-2 18:18:26 | 显示全部楼层 |阅读模式 来自 英国
有一微分方程组,,如下,x1,alph,z3为变量,m1.m2,m3,J2,k1,k2,k3,c1,c2,c3,e,tha为常量,zb,zzb,zzzb为系统激励。
m3*z3''+c3*(z3'-zb'+e*cos(tha)*alph')+k3(z3-zb+e*tha*cos(tha))=0;
m1*x1''+m2(x1''+e*sin(tha)*(alph)'')+m3*x1''+c1*x1'+k1*x1=0;
m2*e*cos(tha)*zb''+m2*e*sin(tha)*x1''+J2*(alph)''+c3*e*cos(tha)*(z3-zb+e*cos(tha)*(alph)')+k3*e*cos(tha)*(z3-zb+e*cos(tha)*(alph))+c2*(alph)'+k2*(alph)=0
用ode45解方程组,
m1=0.001;m2=21;m3=41;J2=0.18;k1=35191;k2=116;k3=40352;c1=677;c2=6;c3=495;e=0.08;tha=1.13;
ic=[0,0,0,0,0,0];
[T,Y]=ode45(@nnn_gz,[0:0.005:30],ic);

nnn_gz为

function dy=nnn_gz(t,y)
     zb = 0.01*cos(1.99*pi*t^2+2*pi*0.05*t);
     %chirp signal z0=sin(2*pi*f0*t+pi*k*t^2)
     %f0=0.05Hz;k=1.99;f1=60Hz,t=30s
     zzb=-1/100*sin(199/100*pi*t^2+1/10*pi*t)*(199/50*pi*t+1/10*pi);
     zzzb=-1/100*cos(199/100*pi*t^2+1/10*pi*t)*(199/50*pi*t+1/10*pi)^2-199/5000*sin(199/100*pi*t^2+1/10*pi*t)*pi;
     
m1=0.001;m2=21;m3=41;J2=0.18;k1=35191;k2=116;k3=40352;c1=677;c2=6;c3=495;e=0.08;tha=1.13;

B1=c3/m3;B2=k3/m3;B3=B1;B4=B2;A1=c3*e*cos(tha);A2=k3*e*cos(tha);B5=A1/m3;B6=A2/m3;
A3=m1+m2+m3;A4=m2*e*sin(tha);A5=c2+c3*e^2*(cos(tha))^2;A6=k2+k3*e^2*(cos(tha))^2;
A7=k3*e*cos(tha)+c3*e*cos(tha);A8=m2*e*cos(tha);A9=A7;
D1=-A4/A3;D2=-c1/A3;D3=-k1/A3;
E1=-A8/(A4*D1+J2);E2=A9/(A4*D1+J2);E3=A4*D2/(A4*D1+J2);E4=-A4*D3/(A4*D1+J2);
E5=-A6/(A4*D1+J2);E6=-A5/(A4*D1+J2);E7=-A7/(A4*D1+J2);
F1=D1*E3+D2;F2=D1*E4+D3;F3=D1*E1;F4=D1*E2;F5=D1*E5;F6=D1*E6;F7=D1*E7;
%y(1)=x1;y(2)=dx1;y(3)=alph,y(4)=dalph;y(5)=z3;y(6)=dz3;
dy=zeros(6,1);
dy(1)=y(2);
dy(2)=F1*y(2)+F2*y(1)+F3*zzzb+F4*zb+F5*y(3)+F6*y(4)+F7*y(5);
dy(3)=y(4);
dy(4)=E1*zzzb+E2*zb+E3*y(2)+E4*y(1)+E5*y(3)+E6*y(4)+E7*y(5);
dy(5)=y(6);
dy(6)=B1*zzb+B2*zb+B3*y(6)+B4*y(5)+B5*y(4)+B6*y(3);
end
计算结果Y(:,1)为NaN,数量级达到10e302,请大家帮忙看看,问题很长,不胜感激!!!
发表于 2009-8-4 16:57:54 | 显示全部楼层 来自 上海
Simdroid开发平台
NaN returns the IEEE arithmetic representation for Not-a-Number (NaN). These result from operations which have undefined numerical results.
These operations produce NaN: Any arithmetic operation on a NaN, such as sqrt(NaN) Addition or subtraction, such as magnitude subtraction of infinities as (+Inf)+(-Inf) Multiplication, such as 0*Inf Division, such as 0/0 and Inf/Inf Remainder, such as rem(x,y) where y is zero or x is infinity
Please check out your unit is valid,and matrix is wrong.
回复 不支持

使用道具 举报

发表于 2009-8-7 21:06:32 | 显示全部楼层 来自 澳大利亚
有奇点有奇点
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Simapps系列直播

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-10-7 07:29 , Processed in 0.052775 second(s), 14 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表