How to hold maximum value of one signal for maximum value in seconds?
Afficher commentaires plus anciens
Hi all,
I have a signal that indicates time difference between sequences. That value is calculated for few samples, then evalues back to zero. I'd like to catch those calculated sequence changing times and implement in other calculations. I can't use zero order hold block since I have fixed sample time for my Simulink model. Do you have any other suggestions?
Thank you.
6 commentaires
Sam Chak
le 6 Déc 2023
Hi @Hasan Kaan Tuna, I'm unsure if I interpreted the problem correctly. Can you sketch the signal and the expected outcome of "holding" the maximum value of the signal for [a duration of time] in unit [seconds]?
Hasan Kaan Tuna
le 6 Déc 2023
Modifié(e) : Sam Chak
le 6 Déc 2023
Sam Chak
le 6 Déc 2023
Thanks. So, you need the algorithm to continuously detect the maximum value of the signal without any knowledge of the future. For example, the first local maximum is approximately
. Do you want to hold this value for
seconds?
Hasan Kaan Tuna
le 6 Déc 2023
Sam Chak
le 6 Déc 2023
I think tracking can be done by comparing the current value
with the previously sampled value
and then evaluating which one is greater. If the current value is greater, then take it as
and set it to hold for a duration equivalent to its value.
However, I'm unsure of how you want the algorithm to work. After holding the
value for a period of time, what specific actions do you want the algorithm to take next? Can you sketch the task flow diagram and update your question? This will allow other users to gain a better understanding of your problem without scrolling down to read other comments.
@Hasan Kaan Tuna, can you take this cosine signal as an example?
n = 0:0.5:15;
y = cos(2*pi*n/10);
stem(n, y), grid on
ylim([-1.5 1.5])
xlabel t, ylabel y
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Switches and Breakers dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

