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

1 Ansicht (letzte 30 Tage)
Hi, this error is occurred.
Error using DynamicSystem/lsim
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.
Error in untitleds (line 321)
[Responset_q_equi] = lsim(sysansq_equi , INPUT_equi , tempo);
I thought of solving by considering INPUT_equi as a 5-row vector, since the state space matrix B has 5 columns, and 1 column using function repmat but it doesn't work :( even considering the number of lines equal to that of the elements of the time vector does not work
This is the script (sysansq_equi is already defined in the previous part of the script that is not reported here)
%DEFINIZIONE ingressi nel tempo
%load(['Published/','accDX_equi_QUARTER_CAR.dat'])
INPUT_DX_equi_QUARTER_CAR = accDX_equi_QUARTER_CAR(:,2);
tempo = accDX_equi_QUARTER_CAR(:,1); % è uguale per ogni caso avendo ip. per ogni caso v = 4 m/s
% cioè 14.4 km/h
dt=mean(diff(tempo)); %calcola la media degli incrementi tra tempo(i) e tempo(i+1) per ogni i
Fmax=1/(2*dt); % Nyquist -- Fmax = Fc/2
%load(['Published/','accSX_equi_QUARTER_CAR.dat'])
%INPUT_SX_equi_QUARTER_CAR = accSX_equi_QUARTER_CAR(:,2);
max(accDX_equi_QUARTER_CAR(:,2))
%max(accSX_equi_QUARTER_CAR(:,2))
INPUT_equi = INPUT_DX_equi_QUARTER_CAR;
[Responset_q_equi] = lsim(sysansq_equi , INPUT_equi , tempo);
figure (9)
plot(tempo,Responset_q_equi)
xlabel('Tempo [s]')
ylabel('q')
grid on
legend('q1','q2','q3','q4','q5','q6','q7','q8','q9','q10')
title('Coordinate normali caso equiripartito')
p.s. sysansq_equi doesn't contain errors

Akzeptierte Antwort

Paul
Paul am 5 Aug. 2022
Hi Federico,
If sysansq_equi.B has five columns then INPUT_equi must also have five columns. Also, the number of rows of INPUT_equi must be the same as numel(tempo). What are the outputs of the following commands:
size(sysansq_equi.B,2)
numel(tempo)
size(INPUT_equi)
  5 Kommentare
Paul
Paul am 5 Aug. 2022
Bearbeitet: Paul am 5 Aug. 2022
Yes, INPUT_equi must have five columns. If you only want to see the output of the system in repsonse to the first input, then do
[Responset_q_equi] = lsim(sysansq_equi , [INPUT_equi zeros(numel(tempo),4)] , tempo);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by