## Transfer function in Simulink different from Matlab

on 20 Nov 2012

### Pedro Villena (view profile)

Hey everybody,
I am plotting the step response of a transfer function with matlab and the result is fine.
Gs = (1/s^2) * (1 - 2*exp(-s*0.5) + exp(-s))
Now I am trying to build this function in Simulink with standard blocks, but the step response is different from matlab:
and
I have tried many different solver settings but the result is always the same. I anyone has Ideas what might be the problem, please let me know.
Daniel.

Show 1 older comment
Daniel P

### Daniel P (view profile)

on 21 Nov 2012
s=tf('s')
Gs = (1/s^2) * (1 - 2*exp(-s*0.5) + exp(-s))
step(Gs)
Azzi Abdelmalek

### Azzi Abdelmalek (view profile)

on 21 Nov 2012
What version of matlab are you using? this did'nt work for me
Daniel P

on 21 Nov 2012
Version R2012a

### Pedro Villena (view profile)

on 21 Nov 2012
Edited by Pedro Villena

### Pedro Villena (view profile)

on 21 Nov 2012

Gs = (1/s^2) * (1 - 2*exp(-s*0.5) + exp(-s))
Gs = 1/s^2 - (2/s^2)*exp(-s*0.5) + (1/s^2)*exp(-s)

Daniel P

### Daniel P (view profile)

on 21 Nov 2012
I will try that later. Thanks for your effort.
Daniel P

### Daniel P (view profile)

on 21 Nov 2012
That looks good. It seem to work for the moment. Thank you very much.

### Ryan G (view profile)

on 20 Nov 2012

The easiest way to achieve the desired results would be with the LTI System block which comes with the Control System Toolbox. This allows you to create a system in MATALB and directly utilize it in Simulink.
However, your model as shown works. You need to adjust the relative tolerance in the configuration parameters to be tighter. Try 1e-6 or 1e-8 and check the results.

Daniel P

### Daniel P (view profile)

on 20 Nov 2012
Hello Ryan.
Are you talking about the relative tolerances of the Integrators? I have tried to reduce them to 1e-10 but still the same (bad) result.
Any other suggestions?