Hi I need a help for generating a traingle wave with a Random period in Simulinik or code Matlab ???

 채택된 답변

Jonas
Jonas 2019년 7월 8일
편집: Jonas 2019년 7월 8일

0 개 추천

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

i didn't understand your answer, can you explain to me more, and thnks
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
How can I generate sawtooth wave with random period in matlab version 2014a? please help me with the matlab code

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 General Applications에 대해 자세히 알아보기

태그

질문:

2019년 7월 6일

댓글:

2021년 5월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by