Simulink - saw tooth signal minimum counter
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi guys,
I have a sawtooth singal, from which i am trying to create a signal with alternating sing. Meaning after one "tooth" (one rising and one falling edge) i want to change the sign to + or -1. Resulting in a signal alternating from -1 to 1 and so on. I tried using the derivative and then a sign block, but that does not yield a working result. I thought about implementing a counter that counts up as soon as the min value is reached, meaning that the sign of the derivative has changed. So in theory counting the local minima of the sawtooth signal. Do you have an idea how to implement that?
Thanks in advance!
2 comentarios
Respuesta aceptada
Paul
el 5 de Oct. de 2021
Assuming that your signal has sharp corners .... One approach may be to:
Input the signal into a Detect Increase block. The output of that block will flip from 0 to 1 at the minimum corner. Feed the ouput of that block into a Triggered Subsystem. By default that subsystem will execute on the rising edge of the input, i.e., when the sawtooth turns the minimum corner. In that subsystem, use a simple loop with memory block that increments a count when the subsystem is triggered.
The accuracy, i.e., the time when the count increments, of this approach will depend on the sample rate of the sawtooth and the step size of the solver, both of which you should have some control over.
A similar, but more robust approach, would be to use a zero crossing or hit detection indicator exactly at the reversal, but nothing obvious comes to mind as to how to implement that.
Más respuestas (0)
Ver también
Categorías
Más información sobre Sources en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!