[求助]一个实例的求解出现问题,大侠请进
那位大侠给看一下,本人不胜感激 M文件是:function fun=xuan(t,x,xd)
m1=2;
m2=5;
L=5;
p=100;
k=1000;
fun=[xd(1)-x(7);
xd(2)-x(8);
xd(3)-x(9);
xd(4)-x(10);
xd(5)-x(11);
xd(6)-x(12);
m2*xd(7)-m2*x(6)*sin(x(5))*xd(11)+m2*cos(x(5))*xd(12)-cos(conj(x(5)))*x(15)-sin(conj(x(5)))*x(16)-m2*x(6)*cos(x(5))*xd(11)^2-2*xd(11)*m2*xd(12)*sin(x(5));
m2*xd(8)+m2*x(6)*cos(x(5))*xd(11)+m2*sin(x(5))*xd(12)-sin(conj(x(5)))*x(15)+cos(conj(x(5)))*x(16)-m2*x(6)*sin(x(5))*xd(11)^2+2*xd(11)*m2*xd(12)*cos(x(5));
m1*xd(9)+x(13)+cos(conj(x(5)))*x(15)+sin(conj(x(5)))*x(16);
m1*xd(10)+x(14)+sin(conj(x(5)))*x(15)-cos(conj(x(5)))*x(16);
-m2*x(6)*sin(x(5))*xd(7)+m2*x(6)*cos(x(5))*xd(8)+(1/12*m1*L^2+m2*x(5)^2)*xd(11)+1/2*conj(L*sin(x(5)))*x(13)-1/2*conj(L*cos(x(5)))*x(14)+conj(-(x(3)-x(1))*sin(x(5))+(x(4)-x(2))*cos(x(5)))*x(15)+conj((x(3)-x(1))*cos(x(5))+(x(4)-x(2))*sin(x(5)))*x(16)-p+2*xd(11)*m2*x(6)*xd(12);
m2*cos(x(5))*xd(7)+m2*sin(x(5))*xd(8)+m2*xd(12)+k*x(6)-x(15)-xd(11)^2*m2*x(6);
x(3)-1/2*L*cos(x(5));
x(4)-1/2*L*sin(x(5));
(x(3)-x(1))*cos(x(5))+(x(4)-x(2))*sin(x(5))-x(6);
(x(3)-x(1))*sin(x(5))-(x(4)-x(2))*cos(x(5))];
求解过程为:
x0=;x0f=;xd0=;xd0f=[];
=decic(@xuan,0,x0,x0f,xd0,xd0f);
错误为:
?? Error using ==> decic>sls
Try freeing 4 fixed components.
Error in ==> decic at 83
= sls(res,dfdy,dfdyp,neq,free_y,free_yp);
回复:(lidongdu51)[求助]一个实例的求解出现问题,大...
<P>给出的x0多了4个</P> 应该有16个未知量,如果减少4个x0的话,出现的问题是:
x0=;x0f=;xd0=;xd0f=[];
=decic(@xuan,0,x0,x0f,xd0,xd0f);
??? Attempted to access x(15); index out of bounds because numel(x)=12.
Error in ==> xuan at 7
fun=[xd(1)-x(7);
Error in ==> decic at 72
res = feval(odefun,t0,y0,yp0,varargin{:}); Happy,你看这个m文件,应该如何写求解命令.<BR> 非常感谢!
页:
[1]