Holding the last value of input signal instead of first value as the zero order hold does
26 ビュー (過去 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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1620968/image.png)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1620973/image.png)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1620978/image.png)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1620983/image.png)
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!