Holding the last value of input signal instead of first value as the zero order hold does
24 次查看(过去 30 天)
显示 更早的评论
I want to hold the last value in the time period instead of first one. how can I do that?? The 'zero order hold ' block holds the first value in the time period for the entire time period.
4 个评论
Jonas
2022-6-29
what exactly is your input signal? can you show an example of input and output you want to have? is this all resitrcted to Simulink or can we use normal Matlab?
回答(1 个)
Gautam
2024-2-19
Hi Shazma,
I understand that you intend to add two signals with different sample times using the Simulink “add” block, such that the output signal is produced at certain time instances.
The desired output can be achieved using a “triggered subsystem”. A triggered subsystem runs the internal blocks whenever a trigger condition is met.
In the image above, the subsystem “Sum” is a triggered subsystem that produces the sum of the two input signals whenever the trigger condition is met by the “Trigger Signal”.
The “Trigger Signal” is a rectangular pulse with a time period of 1 sec and 50% duty cycle.
The “Sum” subsystem produces an output whenever the subsystem encounters a rising edge (transition from the value “0” to value “1”) in the “Trigger Signal” which happens at a time interval of 1 sec.
You can make a triggered subsystem by adding a “Trigger” block from “Simulink/Ports and Subsystems” library as in the image below.
By default, the “trigger type” parameter of the block is set to “rising”.
Below is the output of the model that produces the sum of the two input signals at time intervals of 1 sec.
The plot in red is the output and the plots in yellow and blue are the input signals with sample time of 0.1 sec and 1 sec respectively.
You can find more information about triggered subsystems from the MathWorks Documentation page linked below
Triggers in MATLAB & Simulink:
https://www.mathworks.com/help/releases/R2019b/simulink/slref/trigger.html?searchHighlight=trigger&s_tid=doc_srchtitle
Thank You,
Gautam Murthy
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!