MATLAB Answers

0

Constant Input

Asked by Tan Edwin on 16 Feb 2011
Im interested in puting an input of constant value of 1 for 5s into my simulink model, i.e at time t=0, value=1 and t=5, the value goes from 1 to 0 immediately.
Ive tried using 2 step function and also tried using the signal builder block but they did not give me the results i wanted because of the gradual decrease from 1 to 0 at the time near t=4.9 to t=5.
Is there any method or other blocks i can use to help me solve this?

  0 Comments

Sign in to comment.

1 Answer

Answer by Andreas Goser on 16 Feb 2011
 Accepted Answer

I suppose the observation "gradual decrease" is just a misinterpretation. If you see this in the scope block, Simulink interpolates between (4.9,1) and (5.0,0), but for the simulation, there is something existing between 4.9s and 5.0s.
If you like to changes the vizualization, simply select a smaller step size. But IMHO - the technical constraints shall determine the step size, not the need for good looking.

  3 Comments

Tan Edwin on 16 Feb 2011
im new to Simulink so not sure if im making any sense here.
1) i need the value to be 1 at t=5 instead of 0/t=4.95 to be 1 instead of a value between (0,1) 2) i need the total input value to be 5.
Which both are required for the next part of the simulation. with the 'gradual decrease', it actually affects my calculation in the later parts resulting some errors which propagates as i continue the simulation
Tan Edwin on 16 Feb 2011
I think i beginning to understand what you are trying to explain. Is it because i actually used a fixed step solver for my simulation thats why i have this kind of problem?
Kaustubha Govind on 16 Feb 2011
Yes, it is because of using a fixed-step solver (presumably with step size 0.1) that you see this issue. Try switching to a variable-step solver if you'd like the solver to automatically take smaller steps around the discontinuity.

Sign in to comment.