problem with sine-wave and scope component in simulink
Mostrar comentarios más antiguos
i'm a begginer and trying to learn simulink. following a sample on mathworks site i put a sine-wave and a scope in a simple model. the problem is the shape of sine-wave if remain the frequency at 1 the sine-wave shape is correct but if change the frequency it'll not become like a sine-wave more like a distortion or ramp. i don't know what is the problem.
1 comentario
Leopoldo Pavesi
el 6 de Nov. de 2019
I had the same problem. I regularly use without any problems matlab and simulink for my automatic control lectures, but i needed to generate a sine wave and was frustrated. I believe Kaustubha has given way tp overcome this situation. Many thanks to her
Respuesta aceptada
Más respuestas (2)
Guy Rouleau
el 3 de Dic. de 2011
1 voto
You might be interested by that:
1 comentario
shmd
el 3 de Dic. de 2011
Choosing Maximum Step Size in a Simulink Solver
Example model: Sine Wave Block → Scope Block
When using a sine wave block with frequency 10 rad/sec, the signal often looks not smooth in the Scope.
This happens because Simulink automatically chooses a maximum step size = 0.2, based on three built-in MATLAB rules:
1. Step size < Period ÷ 3
- Frequency = 10 rad/sec → Period = 1/f = 0.6 sec
- Period ÷ 3 = 0.2 sec
2. Step size < (Stop Time – Start Time) ÷ 50
- (10 – 0) ÷ 50 = 0.2 sec
3. Step size must be a fraction of (Stop Time – Start Time)
- Examples: 0.1, 0.2, 0.05, etc.
So with step size = 0.2 sec:
Points per sine cycle = Period ÷ Step size = 0.6 ÷ 0.2 = 3 points per cycle
But 3 points per cycle are not enough for a smooth sine wave.
For smooth display: use 50–100 points per cycle
Better step size choices:
0.6 ÷ 50 = 0.01 sec → smoother wave
0.6 ÷ 100 = 0.006 sec → even smoother wave
Categorías
Más información sobre Simulink en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!