Matlab 4

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Exercise : In this example we will try to illustrate how a difference equation will look

like: y[n]= -0.5*y[n-1]+x[n] and a initial condition y[-1]=1

Further we know that our input signal is a step applied at n=0 with amplitude 1.

Scope
-1
Z
Step Integer Delay

0.5

Gain

Figure
In the scope we can find the solution y[n]. The initial condition is inserted in the Delay
block. I can also select the sampling time in seconds. This can be inserted in both the
Delay and Step block. The output is shown below in figure 12. The Integer Delay can be
found in library: Simulink-> Discrete
Before you run the simulation. Change in Simulation-> Configuration Parameters.
Choose the following: Solver Options-> Fixed-step and Solver-> Discrete
Notice that the difference equation can be formulated from the sum block.
Choose the sample time in each block to 1 sec ( Integer Delay, Step and Gain ).

6
EXERCISE 1. Typical step response of First order Systems

E2 – Step 1. Start the Simulink environment by typing “simulink” to the matlab prompter.
E2 – Step 2. Open a new simulink mode from the File  New  Model
E2 – Step 3. Drag and drop the blocks below from the Simulink windows into the model
window (select “transfer function” from the “Continuous” group; “Step” from
“Sources”; “Scope” from “Sinks”, “Mux” from “Signal Routing”, etc.)
E2 – Step 4. Double click the blocks the set up different first order transfer functions.
Observe the effect of gain and time constant on the dynamic response of the
system.

(A)

(B)

(C)

E2 – Step 5. Identify which response belongs to which transfer function:

Transfer function 1 has response _____;

Transfer function 2 has response _____;

Transfer function 3 has response _____;


EXERCISE 1. Typical open-loop dynamic responses of second order systems

E1 – Step 1. Start the Simulink environment by typing “simulink” to the matlab prompter.
E1 – Step 2. Open a new simulink mode from the File Æ New Æ Model
E1 – Step 3. Drag and drop the blocks below from the Simulink windows into the model
window
E1 – Step 4. Double click the blocks the set up different second order transfer functions.
Define one overdamped, one critically damped and one under damped system.
E1 – Step 5. Connect the blocks together as shown below:

E1 – Step 6. Set the simulation time to 30 sec from the menu “Simulation” Æ
“Configuration parameters”

E1 – Step 7. Simulate the process by pressing the “Run” button and then show the results
by double clicking on the “Scope” block:
Run simulation

Autoscale figure

E1 – Step 8. INDIVIDUAL EXERCISE – Change the form of the transfer function to simulate
(i) an unstable behaviour and (ii) a system at the limit of instability (with sustained
oscillations).

You might also like