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 CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by