Applying single input and single output to mimo system
Afficher commentaires plus anciens
I have a MIMO system and one of the questions presented in my assignment is to plot the open-loop output displacement for unit step input u2(t) and output y3(t), assuming zero initial state. In order to apply this, I zero out my u1&u3 inputs, and for my y3(t), I edit my C matrix to only have 1 in the third column bottom row.
The way I have my code setup is that I have a subplot that produces 3 graphs and a single plot that produces all 3 graphs on 1 plot. When I run my code I expect to see the subplot and the single plot to have the same plots, however this is not the case, am hoping someone can point out where my error is. Be it the way I have set up my plots or the way I set up my matrices.
% Mass values
m1 = 1;
m2 = 2;
m3 = 3;
% Spring Coefficients
k1 = 10;
k2 = 20;
k3 = 30;
k4 = 40;
% Damping Coefficients
c1 = 0.4;
c2 = 0.8;
c3 = 1.2;
c4 = 1.6;
% 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 = [0 0 0 0 0 0;
0 0 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);
t = [0:.01:40]; % Define time values
% Since this section asks for 1 unit step input u2(t), u1(t)& u3(t) is
% zeroed out.
u1 = [zeros(size(t))];
u2 = [ones(size(t))];
u3 = [zeros(size(t))];
u = [u1;u2;u3];
x0 = [0;0;0;0;0;0]; % Assume zero initial state
[Y,t,X0]=lsim(sys_1,u,t,x0);
% Keep this to compare with subplot. This plot produces all 3 plots on 1
% graph.
plot(t,Y)
grid;
X0(101,:);
figure();
subplot(3,1,1)
plot(t,X0(:,1));
grid;
ylabel('Amplitude');
subplot(3,1,2)
plot(t,X0(:,2));
grid;
ylabel('Amplitude');
subplot(3,1,3)
plot(t,X0(:,3));
grid;
ylabel('Amplitude');
xlabel('time (sec)');
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Time and Frequency Domain Analysis 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!

