Effacer les filtres
Effacer les filtres

Lsim with two input signal

14 vues (au cours des 30 derniers jours)
Francesco Marruccelli
Francesco Marruccelli le 6 Fév 2018
Commenté : thiago rech le 12 Nov 2020
I have this system
A = [ 1 1 -1 ; 0 -1 1 ; 0 1 -1 ];
B = [ 1 0 ; 0 1 ; 0 0 ];
C = [ 1 0 0 ];
D = [ 0 ] ;
sys = ss( A , B , C , D )
Now i have to put two signals in input with lsim the two signals are u1( t ) = 2*square( t ) and u2( t ) = 0 i have written something like this
figure( 2 ) ;
t = 0:0.01:10 ;
u = [ 2*square( t ) ];
u2 = zeros( size( t ) ) ;
sys2 = tf( sys ) ;
lsim( sys2 , u , t , x0 );
but i continue to have this error
Error using DynamicSystem/lsim (line 97) 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.
I have tried many ways but i don't know what to do it there isn't nothing on the internet on multi input with lsim please help !
I thank in advance any of you

Réponses (1)

Aveek Podder
Aveek Podder le 22 Fév 2018
Hi,
The input matrix B defined is a 3x2 Matrix, by doing this we have defined a two-input system. For lsim to function as expected we need to pass both the inputs. The error message says the same.
To resolve the issue pass both the input, please use the following command:
>> lsim( sys2 , [u;u2] , t , x0 );
For more information on lsim please have a look at the following link:
  1 commentaire
thiago rech
thiago rech le 12 Nov 2020
Great! What about systems with multiple outputs?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Time and Frequency Domain Analysis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by