Output of Sine and chirp block seems wrong

5 次查看(过去 30 天)
I'm completly new to simulink and testing some stuff and have a problem producing proper plots with the chirp and sine wave blocks. if i just connect a sine block to a scope block i do get smth that's pretty sinelike but it's not a sine, because it's coninuously decreasing its values and its amplitude is not 1, as you can see on the first picture. on the second picture you can see, what the chirp block produces to me. as far as i understood the block, it's supposed to produce a sine wave which has an increasing frequency. But to me this output doesn't even look a little like that. what am i doing wrong?

回答(2 个)

Adam Barber
Adam Barber 2015-8-10
Hey Max,
This is due to the step sizes of the solver that Simulink is choosing. By default Simulink sets the step size to: h_max = (t_stop - t_start)/50. It uses a variable-step solver which will adjust this step based on the system. For the two you provided, it does not refine it to the point where it looks like you might expect.
If you set your simulation time to 10 seconds, Simulink will choose a default step size of 0.2 seconds, which is good enough to capture the 2*pi second period of the default sine wave. When you make the simulation time longer, like 200 seconds for example, it chooses a default step size of 4 seconds, leading to the strange aliasing behavior you see.
You can find more information in the documentation for the solver pane, and in particular under "Tips" you can see the statement "If the time span of the simulation is very long, the default step size might be too large for the solver to find the solution."
What this means is there are two solutions: either reduce your simulation time, or specify the solver time step to be something small.
Hope this helps get you started,
-Adam
  1 个评论
Max E.
Max E. 2015-8-10
First of all: Thank you very much for this extensive answer!
Unfortunatly i could still not solve the Problem. I tried a couple of different things:
1. i tried setting the maxstep value to 0.2 as you suggested by typing "MaxStep '0.2' " into Matlabs command line, because the link you posted says it works like this, but it told me "unknown Variable MaxStep".
2. in my simulink model i chose this direction: file -> simulink preferences -> solver . There i changed MaxSteps value from 'auto' to '0.2', pressed apply and simulated again and nothing changed.
3. under the same direction i changed the "type" from 'variable step' to 'fixed step' and set the step size to '0.2'. again no change. :(
What am i doing wrong?

请先登录,再进行评论。


bharadwaj r
bharadwaj r 2015-8-17
Hey max,
I think its the problem with the scope you are using to see the output. Go to scope setting and in sampling change from decimation to sample time and give the sample time as 10e-6.
Hope this works

类别

Help CenterFile Exchange 中查找有关 Interactive Model Editing 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by