Simulink
Simulink
1
Example:
1.2
0.8
2
0
0 5 10 15 20 25 30
t (sec)
The components:
Main components with dynamics:
– integrators,
– transfer function
– zero-pole description
The first one needs an initial condition.
It can be assigned by clicking on the
component
Math components:
– gain (amplifier) kx : x a scalar
– addition (a+b+c); product (ab); you can
change the number of terms and the sign
of each term
3
Sources: input signals
– constant, step, ramp
– pulse, sine wave, square wave
– from data file
– signal generator
– The clock to record time
4
Example: Find the solution to the systems
y 3y 2y y u
Steps:
1. Open matlab workspace
2. type simulink and return
- simulink library browser window is open
3. Click file and choose new then choose model
- a blank window is open
4. Open one of the commonly used blocks and drag and drop
whatever you need to the blank window.
5. Connect the components by arrows.
5
Click each component to setup the parameters properly
sinks labeled “t”, “u”, “y”: choose “array” for save format
sampling time can be a parameter inputted from workspace
they can be chosen as -1 for inherited
When ready, click simulation and choose configuration parameters
to setup simulation time. Finally, click simulation and choose start
When finished, type plot(t,y,t,u) to plot the input and output 6
How to realize
y ay by cu du (*)
Can we first get v cu du and then realize
y ay by v
Theoretically, we need future information of u(t), t > t 0 to get
the derivative at t0. This cannot be realized.
We may only use the past information to get an approximation.
But still it is better not to use differentiator. If a signal is
contaminated by noises, taking derivative will magnify the noises.
One approach to avoid differentiation is as follows:
- First realize cx (0) dx(0) y(0)
x ax bx u Initial condition
cx (0) dx (0) y (0)
Then set y cx dx determined from
x (0) u(0) ax (0) bx(0)
- You can verify that y satisfies (*).
7
x x
x