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 回表示 (過去 30 日間)
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

採用された回答

Paul
Paul 2022 年 8 月 5 日
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 件のコメント
Paul
Paul 2022 年 8 月 5 日
編集済み: Paul 2022 年 8 月 5 日
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);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by