Lsim gives NaN for square input
Afficher commentaires plus anciens
Hi,
I want to simulate 6 state, 6 output, 1input linear system. But lsim gives NaN. Here is my code. What can I do to fix this problem? Thanks in advice.
m=3255;
ms =2956;
a =1.459;
b= 1.895;
h =1.234;
hsr= 0.781;
Cf=-120000;
Cr= -120000;
Tr =1.615;
Ixx= 1830;
Iyy= 6488;
Izz= 7913;
Ixz= 500;
D= 4500;
K= 145330;
f= 0.7;
r= 0.23;
g =9.81;
u=13.4;
M=[m 0 ms*hsr 0 0 0;
ms*hsr -Ixz Ixx+ms*hsr*hsr 0 0 0;
0 Izz 0 -Ixz 0 0;
0 0 0 1 0 0;
0 0 0 0 1 0;
0 0 0 0 0 1];
N=[0 m*u 0 0 -1 -1;
0 ms*hsr*u D K-ms*hsr*g 0 0;
0 0 0 0 -a -b;
0 0 -1 0 0 0;
-Cf/f -a*Cf/f 0 0 u/f 0;
-Cr/r b*Cr/r 0 0 0 u/r];
F=[0 0 0 0 Cf*u/-f 0].';
A=-M*N;
B=-M*F;
C=diag(ones(6,1));
sys=ss(A,B,C,0);
k=0:0.1:10;
i=1;
for t=0:0.1:10
Sf(i)=0;
if t>=1
if t<=3
Sf(i)=0.1;
end
end
i=i+1;
end
y=lsim(sys,Sf,k);
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Control System Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
