Error using DynamicSystem/lsim
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sahithi Laxmi
il 7 Dic 2022
Commentato: Star Strider
il 7 Dic 2022
clc
% Define the matrices
A = [-1 2 ; 0 -3];
B = [1 ; 1];
C = [1 2];
D = 1;
% System TF
G = ss(A,B,C,D);
% Define the time vector
t = 0:0.1:10;
% Define u(t)
u = 1;
% Plot the response
figure;
lsim(G,u,t);
grid
This is my code and I'm getting the following error
Error using DynamicSystem/lsim
When simulating the response to a specific input signal, the input data U must be a matrix of numeric values with at least two rows (samples) and without
any NaN or Inf.
0 Commenti
Risposta accettata
Star Strider
il 7 Dic 2022
Instead of:
% Define u(t)
u = 1;
use:
% Define u(t)
u = ones(size(t,2),1);
Then, it works —
% clc
% Define the matrices
A = [-1 2 ; 0 -3];
B = [1 ; 1];
C = [1 2];
D = 1;
% System TF
G = ss(A,B,C,D)
% Define the time vector
t = 0:0.1:10;
% Define u(t)
u = ones(size(t,2),1);
% Plot the response
figure;
lsim(G,u,t);
grid
.
2 Commenti
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
