![]() |
[求助]关于倒立摆设计的Matlab程序问题,不知错在哪里!!
[SIZE="5"][求助]关于倒立摆设计的Matlab程序问题,不知错在哪里!!谢谢高手能看看!
报错“??? Undefined command/function 'sine'.” ml=128.57/1000; L1=0.6; m2=190/1000;L2=0.115; C=0.00157;km=0.02; g=9.8; p=(3*ml*ml+4*ml*m2)*L1*L2; A=[0,1,0,0;0,0,-9*ml*ml*g*L1*L2/(p*L1),18*ml*L2*C/(p*L1);0,0,0,1;0,0,(18*ml*ml+6*ml*m2)*g*L1*L2/(p*L2),-(36*ml+12*m2)*L2*C/(p*L2)]; B=[0;12*ml*L1*km/(p*L1);0;-18*ml*L1*km/(p*L2)]; C=[1 0 0 0;0 0 1 0]; D=[0;0]; sys=ss(A,B,C,D); T=0:0.01:1; y=step(sys,T); figure(1); plot(T,y); legend('水平杆偏角','垂直杆偏角'); co=ctrb(A,B);ob=obsv(A,C); Controllability=rank(co); Observability=rank(ob); %x=1;y=1; x=5000;y=100; Q=[x 0 0 0;0 0 0 0;0 0 y 0;0 0 0 0]; R=1; K=lqr(A,B,Q,R); Ac=[(A-B*K)];Bc=[B]; Cc=[C];Dc=[D]; %T=0:0.1:10; T=0:0.001:1.5; U=0.2*ones(sine(T)); Cn=[1 0 0 0]; figure(2); [Y,X]=lsim(Ac,Bc,Cc,Dc,U,T); plot(T,Y) legend('水平杆偏角','垂直杆偏角'); Nbar=-55.55; %rscale(A,B,Cn,0,K); Bc=[Nbar*B]; figure(3); [Y,X]=lsim(Ac,Bc,Cc,Dc,U,T); plot(T,Y) legend('水平杆偏角','垂直杆偏角')[/SIZE] |
回复: [求助]关于倒立摆设计的Matlab程序问题,不知错在哪里!!
U=0.2*ones(sine(T));
改成 U=0.2*ones(sin(T)); |
回复: [求助]关于倒立摆设计的Matlab程序问题,不知错在哪里!!
谢谢!但改了之后还是由问题!!
[COLOR="Red"]??? Error using ==> lti.lsim at 81 Error using ==> ltipack.ssdata.utCheckComputability at 47 When simulating the response of a linear system, the input data U must have as many columns as system inputs. Error in ==> lsim at 113 [yout,t1,x] = lsim(sys,u,t,x0);[/COLOR] |
回复: [求助]关于倒立摆设计的Matlab程序问题,不知错在哪里!!
哈哈,找的问题所在了,sine改为size,是印刷错误
U = 0.2*ones(size(T)); |
所有时间均为北京时间。现在的时间是 11:23。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.