Difference using lsim and simulink model transfer function block with equal transfer functions

7 次查看(过去 30 天)
Hi all, I am working on a model of an air fan. The input is a PWM signal between 0% and 100%, the output is fan speed in rpm. I have estimated transfer functions from measured data for two step responses: from 0%-15% and from 15%-20%. For the estimation I used data that starts at zero. So for 15%-20%, the input data range is actually from 0%-5%. For the simulation with lsim I use this data and tf and add the fan speed that it started with. This leads to very accurate results between measured values and simulated using lsim.
However I want to implement these transfer functions in a Simulink model. I use the same strategy as with lsim, but the results do not agree. 0-15 is the same but 15-20 is not. I use an S-function to alter the nominator and denominator of the transfer function block.
I understand it is difficult to answer this question without files, but the main question is: How can I get the same results as with lsim using a transfer function in Simulink?
Thanks in advance.
Best, Gijs

回答(3 个)

Alexis Nguyen
Alexis Nguyen 2012-2-15
Hi Gijs,
Have you solved your problem? Could you please let me know the answer. I'm also trying to solve this.
Thanks

Gijs
Gijs 2012-2-16
Hello Alexis, I have solved my problem by writing an s-function instead of using a transfer function block. I have rewritten the transfer function H = Y/U using the 'inverse z-transform' and simply use the right coefficients. This gives you y(k+1) as a function of y(k), y(k-1) and u(k-1) for example.
Good luck, Gijs

Matheus WV
Matheus WV 2020-9-14
I had a similar issue. In my case the problem was on the estimation. As data is discrete, MATLAB has to assume the values of the input variables between samples. As the property 'InterSample' was not specified, a First-order hold was assumed. Simulink, on the other side, uses a zero-order hold.
Changing the data from
id_data = iddata(i_is,V_is,Ts);
to
id_data = iddata(i_is,V_is,Ts,'InterSample','zoh');
solved the problem.

类别

Help CenterFile Exchange 中查找有关 Model Predictive Control Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by