When simulating the response to a specific input signal, the input data U must be a matrix with as many rows as samples in the time vector T, and as many columns as input channels.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Zain Zia
am 26 Nov. 2020
Kommentiert: Mathieu NOE
am 30 Nov. 2020
Hi all, I'm getting an error with the u matrix, the situation is 3 train carts coming to a rest so, there is a pulling force represented by the u matrix. I left in the sinusoidal force as that gave results but, I would like to get results with initial parameters.
Thanks, Zain
clear
clc
m1 = 69000;
m2 = 65000;
m3 = 126000;
k1 = 8000;
k2 = 8500;
c1 = 5200;
c2 = 6000;
%to = 0:0.5:10
Z = zeros(3);
M = [m1 0 0; 0 m2 0; 0 0 m3];
Co = [c1 -c1 0;-c1 (c2+c1) -c2; 0 -c2 c2];
K = [k1 -k1 0; -k1 (k1+k2) -k2; 0 -k2 k2];
Minv = inv(M);
I = eye(3);
MC = Minv*Co;
KC = Minv*K;
A = [-MC -KC; I Z];
B = eye(6);
C = eye(6);
D = zeros(6);
state = ss(A,B,C,D)
t = 0:0.01:20;
%u = 158005*sin(3.142*t);
u = [87567; 0; 0; 0; 0; 0];
u = repmat(u, 6, 1);
sys = ss(A,B,C,D);
x0 = [4.17;4.17;4.17;0;0;0];
y = lsim(state,u,t,x0);
hold on
x1 = y(:,1);
figure(1)
xlabel('Time (s)');
ylabel('Displacement');
title('Displacement against time')
plot(t,x1)
grid
hold off
0 Kommentare
Akzeptierte Antwort
Mathieu NOE
am 29 Nov. 2020
hello
this seems to work better :
clear
clc
m1 = 69000;
m2 = 65000;
m3 = 126000;
k1 = 8000;
k2 = 8500;
c1 = 5200;
c2 = 6000;
%to = 0:0.5:10
Z = zeros(3);
M = [m1 0 0; 0 m2 0; 0 0 m3];
Co = [c1 -c1 0;-c1 (c2+c1) -c2; 0 -c2 c2];
K = [k1 -k1 0; -k1 (k1+k2) -k2; 0 -k2 k2];
Minv = inv(M);
I = eye(3);
MC = Minv*Co;
KC = Minv*K;
A = [-MC -KC; I Z];
B = eye(6);
C = eye(6);
D = zeros(6);
state = ss(A,B,C,D)
t = 0:0.01:20;
%u = 158005*sin(3.142*t);
u = [87567; 0; 0; 0; 0; 0];
% u = repmat(u, 6, 1);
u = u*ones(1,length(t));
sys = ss(A,B,C,D);
x0 = [4.17;4.17;4.17;0;0;0];
y = lsim(state,u,t,x0);
hold on
x1 = y(:,1);
figure(1)
xlabel('Time (s)');
ylabel('Displacement');
title('Displacement against time')
plot(t,x1)
grid
hold off
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Assembly finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!