Calculating the amplitude of a sine wave in simulink

74 visualizaciones (últimos 30 días)
B M
B M el 1 de Feb. de 2011
Comentada: Franck Joel Simo el 7 de Mayo de 2019
I am trying to create a feedback control loop that will give me a constant amplitude of a sine wave for any frequency. The sine wave is being generated by an external sensor and is an input into my control signal which will then calculate the correct propotional gain to give the constant amplitude I specify. I am trying to find a method of calculating the current peak (this all needs to be done in real time) of the sine wave? So far I have only been able to calculate each position of the sine wave while it goes through one wave length. Can someone tell me how I can store all of this data in Simulink (i.e it cannot go out to the MATLAB workspace) so that I can find the maximum value. Or is there another better way to do this?

Respuesta aceptada

Doug Eastman
Doug Eastman el 1 de Feb. de 2011

There is a block in the Math Operations library called 'MinMax Running Resettable' that will do exactly what you would like. Connect the sine wave to the first port and you'll have to create another signal to reset the block every period (or several periods). One approach to creating the reset signal might be to use the 'Detect Rise Positive' block from the Logic and Bit Operations library on the sine wave. Here's an example model:

  1 comentario
Franck Joel Simo
Franck Joel Simo el 7 de Mayo de 2019
Hallo , i am looking for a similar way. i want to determine the period a signal in Simulink. How do we do that?any idea?Thanks in Advance

Iniciar sesión para comentar.

Más respuestas (2)

Paulo Silva
Paulo Silva el 1 de Feb. de 2011
I found a way but there's a problem with it, try using the MinMax block, set it up to be Max and with 2 inputs, connect your sine wave to one input and the other input to the output of MinMax (feedback style), that way the MinMax block always show the maximum value of the wave, the problem is that it won't reset.

Justus Lipper
Justus Lipper el 6 de Ag. de 2018
Hello, i am searching for a similar calculation. My problem is that my sine wave can increase and decrease depending of a variable input (picture "1"):
With the solution mentioned in this thread, it works till the amplitude "value" is not increasing (picture "2"):
How can i change the reset behaviour so it allways outputs the "local" maxium? Or is there any other way i cant think off.
I hope its fine that i answer in this old thread, because i thought its easier to understand what my problem is.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by