필터 지우기
필터 지우기

Lsim inputs inversion provide the same result

조회 수: 1 (최근 30일)
Lorenzo Bernardini
Lorenzo Bernardini 2022년 4월 13일
댓글: Lorenzo Bernardini 2022년 4월 14일
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.

채택된 답변

Paul
Paul 2022년 4월 13일
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)
ans = logical
1
Not sure TMW would consider this a bug. Certainly undocumented behavior.
Did it cause a problem or just asking out of curiosity?
  댓글 수: 1
Lorenzo Bernardini
Lorenzo Bernardini 2022년 4월 14일
Thank you very much for your answer Paul!
Actually, it was a curiosity. I found this behaviour very strange and I was wondering if I was the only one to experience it. The point is that sys and u are very different inputs, as you know, and it sounded remarkably weird that the inversion gave me equal outcomes to the case in which the inputs were inserted in the suggested way. With the inversion, I was expecting at least to get different results or a warning/error.
Again, thank you for your time and clear answer.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Time and Frequency Domain Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by