MATLAB Answers

Ho to convert a signal from discrete to continuous in Simulink block diagram?

163 views (last 30 days)
xavg
xavg on 1 Dec 2015
Commented: Hari Ranga on 20 Dec 2020
I have a discrete-time controller, and I want to plot the continuous-time step response of my closed loop system with a Simulink block diagram. I know how to do the steps using regular matlab programming and how to get the discrete-time step response in simulink. But then I would need a block to transform the discrete response to a continuous one and I can't find it.
In code the operations are
T_discrete=feedback(G_discrete*K_discrete,1);
T_continuous=d2c(T_discrete,'zoh');
Basically my question is: can I simply create a closed loop with G_discrete and K_discrete in Simulink and then use a block equivalent to the "d2c" function to get a continuous-time step response?
Thank you!

Answers (1)

Sebastian Castro
Sebastian Castro on 25 May 2017
Even better! In Simulink, you don't need to convert your plant model to a discrete system.
If your controller block(s) are discrete, you can pass them directly into continuous block(s), so you truly have a discrete input acting on a continuous-time plant. This may be preferred to the MATLAB approach which forces you to discretize your plant model to the same rate of the controller.
For example, try connecting a Discrete Transfer Fcn block to a Transfer Fcn block. You can also check the block sample times in the Simulink menu under Display > Sample Time > All.
- Sebastian
  1 Comment
Hari Ranga
Hari Ranga on 20 Dec 2020
Interesting, so with this setup how come Simulink does not complain about driving continuous state block with discrete inputs?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!