chsafouane
chsafouane

Reputation: 311

SIMULINK - Strange Sine wave plot

So I'm new to Simulink (I've been working on it for less than 1 hour). I've put a "Sine Wave" block with an amplitude of 3 and a frequency of 2*pi and connected it to a "Scope". The problem is that the plot has some kind of edges:

enter image description here

Would you mind telling me, please, how to fix this?

Thank you !

Upvotes: 1

Views: 2413

Answers (2)

Delun Zhang
Delun Zhang

Reputation: 21

Here is the path to solver settings: Your Simulink model -> Modeling -> Model Settings -> Model Settings -> Solver -> Solver: ode45, Max step size: 0.1.

Upvotes: 0

am304
am304

Reputation: 13876

This is because by default Simulink chooses a time step of the simulation end time divided by 50, unless the dynamics of the model requires smaller time steps (for a variable step solver).

I assume you haven't changed any of the solver settings, in which case you probably have ode45 as a solver with the default settings. Change the MaxStepSize to be something small, say 0.1s or even smaller. The simulation will take a bit longer but you'll get more data points and therefore a smoother curve.

Have a read of Choose a Solver in the Simulink documentation for more details.

Upvotes: 4

Related Questions