How can I generate triangular wave with random period ?

4 vues (au cours des 30 derniers jours)
Zerdani Mohammed
Zerdani Mohammed le 6 Juil 2019
Commenté : debojit sharma le 24 Mai 2021
Hi I need a help for generating a traingle wave with a Random period in Simulinik or code Matlab ???

Réponse acceptée

Jonas
Jonas le 8 Juil 2019
Modifié(e) : Jonas le 8 Juil 2019
Use an Integrator block which you reset each time it becomes lower than zero, and use a random - but constant - input. Reset another time it reaches the level of the period corresponding with the random input. For this second reset, change the sign of the input.
  3 commentaires
Jonas
Jonas le 31 Juil 2019
Hi
Allow me to elaborate on my suggested answer.
Assume you have a simulation with a discrete sample time of 1 seconds. If you use the Discrete Time Integrator with a gain of 1, it's output will be 0 initially. In case you would give it an input of 1, after one second the output will be 1, and after two seconds the output will be 2. If you would give it an input of 2, the output will be 2 after one second, and 4 after two seconds. So if you want to create the rising edge of the triangle, you should use an Integrator block with gain 1, and use a random input.
So now the integrator is creating a rising flank with a random steepness. You should now reset the integrator (you can have an External Reset) when the output of the integrator reaches 1. This means we have reached the top of the triangle.
Now we want to create the downwards-going flank of the triangle wave. We should now give the integrator the same input, but with a negative sign such that it creates a downwards going flank. Also, the initial value should be 1, otherwise it will start going down starting from 0. The input should be the same as for the upwards going flank so you might want to save it in memory.
When the integrator now reaches 0, we have completed the triangle wave (we went up, to 1, and down again to 0). We want to reser the integrator and start all over again by using a new random input again.
With kind regards,
Jonas
debojit sharma
debojit sharma le 24 Mai 2021
How can I generate sawtooth wave with random period in matlab version 2014a? please help me with the matlab code

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by