Lsim inputs inversion provide the same result
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Lorenzo Bernardini
il 13 Apr 2022
Commentato: Lorenzo Bernardini
il 14 Apr 2022
Hello to everybody,
I am using Matlab 2019b.
Provided that sys is a transfer function written using the command tf, u a time signal and t the corresponding time vector of the same length of u.
If I write: y=lsim(sys,u,t) I get the very same result of writing y=lsim(u,sys,t), with no warnings at all. Why is this happening?
Thank you very much in advance.
0 Commenti
Risposta accettata
Paul
il 13 Apr 2022
Interesting. A quick look at the code, at least for the case where an output argument is specified, shows that the function that parses the inputs to lsim() doesn't enforce that the first argument(s) in the list must be a dynamic system object. In fact, I don't think it enforces any order other than that u comes before t, and t comes before x0.
For example:
sys = tf(1,[1 1]);
t = 0:10;
u = rand(size(t));
method = 'foh';
y1 = lsim(sys,u,t,method);
y2 = lsim(method,u,sys,t);
isequal(y1,y2)
Not sure TMW would consider this a bug. Certainly undocumented behavior.
Did it cause a problem or just asking out of curiosity?
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Classical Control Design in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!