Hold multiple values in a signal

1 view (last 30 days)
Nazmi Berk Çelik
Nazmi Berk Çelik on 21 Jul 2022
Answered: Andy Bartlett on 21 Jul 2022
I=imread('model.jpg');
imshow(I);
K=imread('signal.jpg');
imshow(K);
M=imread('signal_points.jpg');
imshow(M);
I have a discrete signal which comes from zero order hold block. In each rise and falling edge point (time interval), I have to keep the value corresponding to those points until the end. I tried to extract these points and sent them to separate enabled subsystems. This method works but not efficient because of manual operation, that is, for example if i have 50 points, there has to be 50 enabled subsystems. I tried that I sent the separate signals to single enabled subsystem by defining trigger array but this ruins holding process in every trigger moment. What kind of method can i use for that?
As you can see from the figures, I have 12 points. And if I use 1 enabled subsystem, an overlapping is observed

Answers (1)

Andy Bartlett
Andy Bartlett on 21 Jul 2022
These ideas may get you moving forward.
1)
In Simulink (unlike MATLAB) signals have fixed maximum lengths and most commonly the length is fixed. You need to design what you want to happen when the fixed limit is exceeded. Keep only the first N values? Keep only the last N values?
2)
For the implementation inside your triggered subsystem,
Use unit delays to hold on to two persistent values.
First, Integer valued scalar representing index_counter of which trigger this is. 0th, 1st, 2nd, ...
Second, vector of length N that holds up to N trigger values.
Feed the unit delay outputs back into themselves but with a little bit of logic on the feedback loop.
For example, feedback loop on index_counter should be increment the value whenever a new value is stored. And if using a circular buffer scheme, some logic to wrap the value back to zero when it exceeds N-1.
Feedback loop on vector signal would use indexing to change just one value in the vector

Categories

Find more on Schedule Model Components in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!