How to convert discrete signal to Continuous signal in Simulink?

23 views (last 30 days)
Hello All,
I am working on one project in which I have to convert signals from continuous to discrete and discrete to continuous. For converting from Continuous to discrete, I am using Zero-order hold block with 0.002 sampling time that is perfectly converting the signals. But when i want to convert it back to continuous from discrete, that ZOH block is not helping me for the conversion.
I have tried to convert those discrete signal through Rate transition block also. but it is still remained in discrete signals only.
Can anyone help me for finding that suitable block to convert discrete signals to continuous signals?

Answers (1)

Fangjun Jiang
Fangjun Jiang on 23 Jan 2024
Paul on 23 Jan 2024
Edited: Paul on 23 Jan 2024
IIUC, all signals in Simulink (when using a continuous solver) are continuous in the mathematical sense, i.e., every signal has a value at any instant in time. I think the answer to this question depends on what the OP is actually attempting to do (for simulation, I'm not sure about code generation for external targets).
In some cases, no additional effort is required. For example, a signal with discrete sample time > 0 can be fed directly into a block with continuous sample time, like an Integrator.
If there is a need to actually convert the sample time of signal from a discrete sample time to continuous but keep the same value (why would that be needed?), then a Rate Transition block can be used (with appropriate block parameters settings). The output will actually be FiM, but I think that's a distinction without a difference in this case because the signal can only change at the input block sample times anyway.
The output of the first order hold does have a continuous sample time, but the value of the signal is changing between samples, which might be unwanted.
Fangjun Jiang
Fangjun Jiang on 24 Jan 2024
I'd rather think that all signals in Simulink (or in digital computer) are discrete, rather than continuous like a signal in an analog circuit.
Anyway, not sure why I answered this question as it was dormant for almost two years. But I think it is the right answer in case someone is searching for the same topic. It is explained in the document of the First Order Hold block.
In the document for the Zero-Order Holder block, there is a tip regarding using the Rate Transition block.

Sign in to comment.


Find more on Prepare Model Inputs and Outputs in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!