Undefined function 'Poles' for input arguments of type 'double'.
Mostrar comentarios más antiguos
I run into the problem where my code produces the error message as stated above. I've searched around and 1 possible problem has something to do with my file path. I have since fixed that but I am still receiving the same problem. Am hoping somebody could help point out my error in the code. I am trying to apply Lyapunov stability analysis to my state space system and plot a phase portrait with the program below.
Any help is much appreciated! Thanks in advance.
% Using Lyapunov analysis, assess the stability properties of the
% system; any case will do since the A matrix is identical for all
% input/ouput cases, the stability condition does not change.
% Check your results via eigenvalue analysis. Plot the phase portraits to
% reinforce your results.
% Values used from chapter 1.
% Mass values
m1 = 1;
m2 = 2;
m3 = 3;
% Spring Coefficients
k1 = 1;
k2 = 2;
k3 = 3;
k4 = 4;
% Damping Coefficients
c1 = 1;
c2 = 2;
c3 = 3;
c4 = 4;
% A, B, C and D matrix generated from chapter 1.
A = [0 0 0 1 0 0;
0 0 0 0 1 0;
0 0 0 0 0 1;
((-1)*((k1+k2)/m1)) (k2/m1) 0 ((-1)*((c1+c2)/m1)) (c2/m1) 0;
(k2/m2) ((-1)*((k2+k3)/m2)) (k3/m3) (c2/m2) ((-1)*((c2+c3)/m2)) (c3/m2);
0 (k3/m3) ((-1)*((k3+k4)/m3)) 0 (c3/m3) ((-1)*((c3+c4)/m3))];
B = [0 0 0;
0 0 0;
0 0 0;
(1/m1) 0 0;
0 (1/m2) 0;
0 0 (1/m3)];
C = [1 0 0 0 0 0;
0 1 0 0 0 0;
0 0 1 0 0 0];
D = [0 0 0;
0 0 0;
0 0 0];
sys_1 = ss(A,B,C,D);
X0(101,:);
if (real(Poles(1))==0 | real(Poles(2))==0) % lyap will fail
if (real(Poles(1)) <=0 | real(Poles(2)) <=0)
disp('System is marginally stable');
else
disp('System is unstable');
end
else % lyap succeeds
Q = eye(6); % Given positive definite matrix
P = lyap(A',Q); % Solve for P
pm1 = det(P(1,1)); % Sylvester's method to see if P is positive definite
pm2 = det(P(1:6,1:6));
if (pm1>0 & pm2>0)
disp('System is asymptotically stable.');
else
disp('System is unstable');
end
end
figure;
plot(Xo(:,1),Xo(:,2),'k');
axis([-1.5 -1.5 -2 1]);
set(gca,'Fontsize',18);
xlabel('\itx_1(rad)');
ylabel('\itx_2 (rad/s)');
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Matrix Computations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!