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

14 vues (au cours des 30 derniers jours)
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

Réponses (3)

Alexis Nguyen
Alexis Nguyen le 15 Fév 2012
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 le 16 Fév 2012
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 le 14 Sep 2020
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.

Community Treasure Hunt

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

Start Hunting!

Translated by