Simulink Unit Delay - Unexpected Behavior
7 views (last 30 days)
Show older comments
While I am well experienced in Mathcad, SPICE, SIMPLIS, I am fairly new to Matlab and Simulink. I created a small Simulink model to explore the behavior of the unit delay and zero order hold (ZOH) blocks. While the ZOH works as I would expect, the unit delay does not.
The souce is a pulse block with a period of 1 us, 50% duty cycle, and an amplitude of 1. I apply this to the input of a unit delay block with a sampling period of 400 ns.
I expect the output of the unit delay to be 0 for 40 ns, change to 1 at 800 ns, 0 at 1.2 us, change to 0 at 1.6 us...
What I get is 0 from 0 to 400 ns, 1 from 200 ns to 1.2 us, 0 from 1.2 us to 1.6 us, 1 from 1.6 us to 2 us....
I have searched here, searched the product help, and even looked in a couple of Matlab/Simulink books lloking for the why Simulink gives this answer.
Any suggestions or guidance would be appreciated.
Thanks in advance.
0 Comments
Answers (1)
Fangjun Jiang
on 17 Jul 2011
A few things to note.
1. The Pulse Generator block outputs 1 for the first 500ns, then 0 for the second 500ns. It's not 0 first and then 1.
2. Sounds like you want to run your simulation at every 400ns, but the fact that your pulse generator is at period of 1000ns and 50% duty cycle. You have to run it at time step=100ns to hit 400ns, 500ns, 800ns ... Use fixed step discrete solver.
Could you try this? It should not be any problem or data discrepancy.
0 Comments
See Also
Categories
Find more on Sources in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!