马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
function ydot=AUVfun(t,y)
%AUV的数学模型
%一些基本参数
a=195;b=20;c=80;d=1000;e=sqrt(y(1)^2+y(2)^2);f=0.086;
g=0.26;h=261;i=0;j=14;k=0;l=-2.25;m=0;n=-0.404;
bh=3.2;aa=y(3)*bh/e;ab=y(4)*bh/e;ac=-0.7;ad=6.95;
ae=0;af=0.075;ag=0;ah=1911;ai=0;aj=0;ak=0;al=0;am=0;an=0;
ba=180;bb=0.67;bc=0;bd=-0.14;be=-0.67;bf=0;bg=asin(y(2)/e);
bi=142;
%垂直舵角输入--弧度
bj=5*pi/180;
%A[]=B
A=[a+b,0,0,0,0,0,0,0;
0,a+h,0,-a*i+j,0,0,0,0;
0,0,ad+ae,0,0,0,0,0;
0,-a*i+j,0,bi+ba,0,0,0,0;
0,0,0,0,1,0,0,0;
0,0,0,0,0,1,0,0;
0,0,0,0,0,0,1,0;
0,0,0,0,0,0,0,1;];
B=[c+1/2*d*e^2*f*g;
a*y(1)*y(4)-k*sin(y(5))+1/2*d*e^2*f*(l*bg+m*aa+n*ab+ac*bj);
a*y(1)*af*y(4)+ag+ah*(af*sin(y(5))+ai*cos(y(5)))+1/2*d*e^2*f*bh*(aj*bg+ak*aa+al*ab+am*bj+an*bf);
a*i*y(1)*(4)-ah*i*sin(y(5))+1/2*d*e^2*f*bh*(bb*bg+bc*aa+bd*ab+be*bj);
y(3);
y(4)*cos(y(5));
y(1)*cos(y(6))+y(2)*sin(y(6))*cos(y(5));
-y(1)*sin(y(6))+y(2)*cos(y(6))*cos(y(5));];
ydot=inv(A)*B;
×××××××××××××××××××××××××××××××××
y0=[2;0;0;0;0;0;0;0];
[t,y]=ode45('AUVfun',[0:0.1:20],y0);
plot(y(:,7),y(:,8))
xlabel('x')
ylabel('y')
解的过程中出现如下错误:
Warning: Failure at t=6.092724e+000. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (2.164570e-014) at time t.
(Type "warning off MATLAB:ode45:IntegrationTolNotMet" to suppress this warning.)
> In C:\MATLAB6p5\toolbox\matlab\funfun\ode45.m at line 335
In G:\matlab work\AUVdel.m at line 2
请问该如何解决?
谢谢 |