Holding the last value of input signal instead of first value as the zero order hold does

조회 수: 21 (최근 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
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?
shazma shazma
shazma shazma 2022년 6월 29일
Here is an example of simulink block diagram, I want to add two signals of different sampling rate i.e 0.1 sec and 1 sec, but I want the summer to calculate output after sampling time of 1 sec instead of 0.1 sec. After every sampling time of 1 second the running sum of the 1st signal(sampling time 0.1) is to be added to the 2nd signal. The plot shows the output of running sum of 1st signal, at the time instant of 1 sec I want the running sum value of 4 to be summed with the 2nd signal. Should I use some other block instead of normal sum block for finding sum at discrete events??
one solution I tried is to use ZOH after running sum to hold its output for sample time of 1 sec but that adds one sampling time delayed running sum to the 2nd signal, as ZOH holds the first value of the sampling time.

댓글을 달려면 로그인하십시오.

답변 (1개)

Gautam
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

카테고리

Help CenterFile Exchange에서 Sources에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by