Sie sind auf Seite 1von 49

System Simulation Laboratory

MANIPAL INSTITUTE OF TECHNOLOGY


MANIPAL
A Constituent Institution of Manipal University

DEPARTMENT OF ELECTRICAL & ELECTRONICS


ENGINEERING

CERTIFICATE

This is to certify that Ms./Mr. …………………...…………………………………

Reg. No. …..….…………………… Section: ………… Roll No.: ………………...

has satisfactorily completed the lab exercises prescribed for System Simulation

Lab [ELE 3212] of Third Year B. Tech. Degree at MIT, Manipal, in the academic

year 2016-2017.

Date: ……...................................

Signature Signature
Faculty in Charge Head of the Department

i
Dept. of E&E, MIT Manipal
System Simulation Laboratory

ii
Dept. of E&E, MIT Manipal
System Simulation Laboratory

CONTENTS

LAB PAGE
TITLE REMARKS
NO. NO.

Course Objectives and Outcomes v

Evaluation Plan & Instructions to the Students vi

Course Plan vii

Module I

1 Tutorial 1 1

2 Tutorial 2 4

3 Tutorial 3 7

Module II

4 Tutorial 4 9

5 Tutorial 5 15

6 Tutorial 6 18

7 Tutorial 7 20

Module III

8 Tutorial 8 22

Module IV

9 Tutorial 9 25

10 Tutorial 10 29

11 Tutorial 11 31

12 Tutorial 12 34

Appendix 36
iii
Dept. of E&E, MIT Manipal
System Simulation Laboratory

iv
Dept. of E&E, MIT Manipal
System Simulation Laboratory

Course Objective
z To use control system Tool Box of MATLB and SIMULINK for obtaining
mathematical models of linear time invariant continuous time systems and
analyze their characteristics.
z To design, implement and appraise controllers for LTI systems.
z To use Signal Processing tool box of MATLB and SIMULINK for obtaining
mathematical models of linear time in variant discrete time systems and
analyze their characteristics.
z To design FIR and IIR filters for LTI systems.

Course Outcomes
At the end of this course, students will be able to
• Model and analyze continuous time/discrete time linear time invariant systems using
MATLAB & SIMULINK.
• Design and implement classical as well as state feedback controllers as per
specifications for a given system.
• Design IIR & FIR filters as per specifications.
• Identify mathematical models of systems from experimental data.
• Demonstrate the integration of software and hardware modules for the purpose of
design of controllers.
• Appraise the performance of uncompensated and compensated systems.
• Apply IIR/FIR filters for power, speech and image signal processing.

v
Dept. of E&E, MIT Manipal
System Simulation Laboratory

Evaluation plan
• Continuous Evaluation - 60%
Class preparation & Documentation - 20
Regularity & Class Performance - 20
Assignments - 20

• End Semester Lab Test - 40%


Initial write up (procedure / program) - 15
Simulation & results - 20
Viva-Voce - 05

INSTRUCTIONS TO THE STUDENTS


1. Students should carry the Lab Manual and Observation Book to every lab session.
2. Be in time and follow the institution dress code.
3. Show the results to the instructors on completion of experiments and copy the
results in the Lab record.
4. The students should not go out of the lab without permission.
5. Theoretical background preparation is mandatory.

vi
Dept. of E&E, MIT Manipal
System Simulation Laboratory

Course Plan
ELE 3212: SYSTEMS SIMULATION LABORATORY
Module I Mathematical Models & Time Domain Analysis of Week 1-3
continuous-time LTI Systems
Transfer function and state variable models
Step/Impulse/Ramp response
Time domain specifications
Steady state error
Stability Analysis
Pole-zero plot, Root-locus analysis, Nyquist plot, Bode plot
System Modelling and analysis (electrical, mechanical &
electro-mechanical)
Module II Time Domain & Frequency Domain Analysis of Discrete- Week 4-7
time LTI Systems
Effect of sampling
Time domain response
Transfer domain representation
Frequency domain response - DFS, DTFT, DFT
Digital Filter Design
Design of FIR filters using windowing, frequency sampling
and Parks McChellan methods.
Design of IIR filter using Butterworth, Chebyshev, Elliptical
Approximations, and direct method
Module III Modelling with SIMULINK Week 8
Armature voltage control of DC motors
Familiarization of Linear Analysis Tool

Module IV Controller design Week 9-11


Using Root locus (Proportional, PI, PD, PID); Familiarization
of Root locus design GUI, Deisgn by Zeigler Nichols and
Auto-tuning
Linear state feedback controller & observer
System identification, Design and implementation of
controllers
Filter design for Power, Image and Speech signal processing
applications

vii
Dept. of E&E, MIT Manipal
System Simulation Laboratory

Reference:
1. D. Hanselman and B. Littlefield, Mastering MATLAB, Prentice Hall, 2011.
2. Norman S. Nise, Control Systems Engineering (5th Ed), John Wiley & Sons, Inc,
2010.
3. V. I. George, C. P. Kurian, Digital Control Systems (1st Ed), Cengage Learning,
2012.
4. Mitra S. K., DSP: A computer based approach (3e), TMH, 2006.

viii
Dept. of E&E, MIT Manipal
System Simulation Laboratory

Module I
TUTORIAL 1
Mathematical Models & Time Domain Analysis of
continuous-time LTI Systems
Objectives:
Familiarization of Transfer function and State space models
To obtain the step/impulse/ramp response of the given system
To measure time domain parameters

1. To enter a transfer function


2 s 3 + 5 s 2 + 3s + 6
G ( s) =
s 3 + 6 s 2 + 11s + 6
num1=[2 5 3 6];
den1=[1 6 11 6];

% To display the system description as a rational function of 's'


printsys(num1, den1,'s')

Also try
sys1=tf(num1, den1)
% To display the factored form of the transfer function
sys2= zpk(sys1);

2. Transfer function to zero-pole conversion (tf2zp)

[z, p, k]=tf2zp(num1, den1)

% To obtain the pole-zero map


pzmap(num1, den1);
Try the reverse transformation zp2tf

3. To find the Partial Fractions of the Transfer function

[r, p, k]=residue (num1, den1)

Try the reverse transformation [num2, den2]=residue(r, p, k)


1
Dept. of E&E, MIT Manipal
System Simulation Laboratory

4. Transfer-function to state-space conversion (tf2ss)

[A, B, C, D]=tf2ss (num1, den1);


Try the reverse transformation ss2tf

5. To find the overall Transfer-function of systems connected in cascade/parallel


Let G1(s) = 3/(s+4) and G2(s) = (2s+4)/(s^2+2s+3)

n_g1 = 3; d_g1 = [1 4];


n_g2 = [2 4]; d_g2 = [1 2 3];

Overall TF of the systems connected in cascade


[n_gc,d_gc] = series (n_g1, d_g1, n_g2, d_g2)

Overall TF of the systems connected in parallel


[n_gp, d_gp] = parallel (n_g1, d_g1, n_g2, d_g2)

Also try

sys1 = tf([3], [1 4]); sys2=tf([2 4], [1 2 3]);


sys3 = sys1*sys2
sys4 = sys1+sys2

6. To find the overall Transfer-function of feedback connected systems

Let G1(s) = (s+1)/(s^2+2s+5) and H1(s) = s/(s+1)

n_g1 = [1 1]; d_g1 = [1 2 5];


n_h1 = [1 0]; d_h1 = [1 1];

sys1 = tf(n_g1, d_g1);


sys2 = tf(n_h1, d_h1);

To find the overall TF of the negative feedback system described above


systf = feedback (sys1, sys2)

2
Dept. of E&E, MIT Manipal
System Simulation Laboratory

7. Obtain the unit step response and the time domain specifications for the system
whose closed loop TF is given by
C ( s) ω n2
a) = where ζ = 0.4 and ω n = 5
R( s) s 2 + 2ζω n s + ω n2
C ( s) 25(1 + 0.4 s)
b) =
R( s) (1 + 0.16s )( s 2 + 6s + 25)
Hint: step (sys): Step response of LTI systems.
Note: Time domain specification includes peak overshoot, peak time, rise time,
delay time, and settling time. For case (a), compare the results with theoretical
values.

8. Obtain the unit step response curves of the system whose system matrices are
A = [-1 -1; 6.5 0], B = [1 1; 1 0], C = [1 0; 0 1], and D = [0 0; 0 0].

9. Obtain the unit impulse response of the system whose TF is given as


1
G ( s) = 2 where ζ is varied from 0.2 to 1.0 in steps of 0.2. Plot all the
s + 2ζs + 1
response curves in single figure window.
Hint: impulse (sys): Impulse response of LTI systems.
1
10. Obtain the unit ramp response of the system G ( s) = 2
.
s + s +1
Hint: To find the unit ramp response of the system G(s), divide G(s) by s and use
step response command.

3
Dept. of E&E, MIT Manipal
System Simulation Laboratory

TUTORIAL 2
Steady state error and Stability analysis
Objectives:
To measure steady state error
To check the stability of the system using pole-zero plots
To obtain the frequency domain response of the system (Bode plot)
To check the stability of the system using root locus
To check the stability of the system using Polar plot & Nyquist plot

dcgain(sys) : computes the steady-state gain of the LTI model sys.


pzmap(sys): Pole-zero plot of LTI systems.
roots(c): Roots of characteristic equation
bode(sys): Bode plot of LTI systems
margin(sys): Gain and phase margin from Bode plot
rlocus(sys): Root locus plot of LTI systems
rlocfind(sys): Find root locus gain for given set of poles
nyquist(sys): Nyquist plot of LTI systems
polar(theta, r): Polar co-ordinate plot
ltiview: GUI for analysis of LTI systems

1. Determine the step, ramp, & parabolic error constants and the steady state
error for the unity feedback control systems with following open-loop transfer
functions (use the function dcgain). Also plot the respective time domain
responses.
5( s + 4)
a) G ( s) =
s ( s + 1)( s + 2)( s + 5)
10
b) G ( s ) = 2
s + 14s + 50
100 1
2. For the system with G ( s ) = ; H (s) = find the appropriate error
s ( s + 10) ( s + 5)
constant and steady state error for a unit step input.
Hint: Find equivalent unity feedback system
3. Check the stability of a unity feedback control system with
K
G ( s) = 2
for K=1 & K=3 by plotting the pole-zero map.
s( s + s + 1)( s + 2)

4
Dept. of E&E, MIT Manipal
System Simulation Laboratory

4. Check the stability of the system whose system matrices are


A = [0 1 0; 0 0 1; -160 -56 -14], B = [0; 1; -14], C = [ 1 0 0], and D = [0]
5. Check the stability of the system with characteristic equation
s 6 + 10s 5 + 36s 4 + 60s 3 + 59s 2 + 50s 2 + 24 = 0 by finding its roots.

6. Obtain the Bode plot, gain and phase margins for the unity feedback control
systems with the open loop transfer function
320( s + 2) 1300
(a) G ( s) = (b) G ( s) =
s ( s + 1)( s 2 + 8s + 24) s( s + 2)( s + 50)
7. Obtain the root locus for K >0 for the system with open loop transfer function
K ( s + 5) K
(a) G ( s ) H ( s) = (b) G ( s ) H ( s ) =
s ( s + 1) s( s + 1)( s + 5)
K K
(c) G ( s ) H ( s ) = 2
(d) G ( s) H ( s ) = 2
( s + 1)( s + 6 s + 13) ( s + 1)( s + 6s + 10)
K K
(e) G ( s ) H ( s ) = 2
(f) G ( s) H ( s ) =
s ( s + 4)( s + 4s + 20) s( s + 1)( s 2 + 4 s + 5)
Find the range of K for which the systems are stable. Compare with the
theoretical results.
8. Obtain the Nyquist plot for the system with open loop transfer function
(2s 2 + 5s + 1) 12( s + 1)
(a) G ( s ) H ( s ) = 2 (b) G ( s ) H ( s) =
( s + 2s + 3) ( s 2 − 6 s + 8)
6400
(c) G ( s) H ( s ) =
s( s + 2)( s + 50)
Also obtain the polar plots of the functions. Check for stability. If the system is
stable find gain margin and phase margin
9. Check the results obtained using ltiview.

5
Dept. of E&E, MIT Manipal
System Simulation Laboratory

ASSIGNMENT 1
K ( s + 50)
a. For the feedback control system with G ( s) = select K so that the
s ( s + 10)( s + 20)
phase margin is 300 and the gain margin is greater than 10db.
100 K
b. For the control system with G ( s) = find the value of gain K to
s( s + 100)( s + 36)
yield 9.5 % overshoot in the transient response for a step input.

c. Use interactive GUI rlc gui to analyze time response and frequency response with
parameter variations.

6
Dept. of E&E, MIT Manipal
System Simulation Laboratory

TUTORIAL 3
System Modelling and Analysis
Objectives:
To obtain transfer function and state space models of electrical, mechanical and electro-
mechanical systems using MATLAB
To obtain time domain and frequency domain analysis
1. For the first order system (spring-damper) shown in Fig.
with spring of stiffness ‘k’ (1 N/m) and damper with
damping constant ‘c’ (0.2 Ns/m).
Derive the mathematical model of the above mechanical
system in state space form and transfer function form.
Find out the response of the system when it is subjected to
the following excitations:
a. A unit impulse excitation
b. A unit step excitation.
c. Harmonic excitation at the identified resonant frequency.
d. Finite steady state error and final value
e. Time domain specifications
2. Develop the mathematical model for the translational
mechanical system shown in Fig.
a. Comment on static characteristics
b. dynamic characteristics when the model is subjected to
the following excitations:
o A unit impulse excitation
o A unit step excitation.
o A harmonic excitation at the identified resonant
frequency.
Parameters are i) m =1g k=1N/m c = 0.2Ns/m
and ii) m = 1g k = 1N/m c = 1.8Ns/m
3. A series R-L circuit is as shown in Fig. develop
its mathematical model in state space form and
transfer function form. For the switch being
closed at ‘t = 0 seconds’, plot the system time
domain and frequency domain responses.
Comment on the steady state and transient
characteristics. Obtain the frequency response and
frequency domain specifications.
Parameters are R = 1Ω L = 1H.
7
Dept. of E&E, MIT Manipal
System Simulation Laboratory

4. A series RLC circuit is shown in Fig.; develop its mathematical model in transfer
function form and state space form. The parameters are i) R=1Ω L=1H C=10mF
ii) R=1Ω L=1mH C=10mF.
Analyze its time domain and frequency domain characteristics, and list out the
observations. Comment on stability of the system.

5. The electric equivalent circuit of the armature voltage controlled DC motor is


shown in Fig. Consider the input of the system to be voltage source (V) applied to
the motor's armature, while the output is the angular velocity . The rotor and shaft
are assumed to be rigid. Also assume a viscous friction model, that is, the friction
torque is proportional to shaft angular velocity. For the given parameter values,
obtain a suitable mathematical models in transfer function form and state space
form. Comment on steady state and transient performance when the model is
subjected to:
o A unit impulse excitation
o A unit step excitation.
• (J) moment of inertia of the rotor 0.01 kg.m^2
• (b) motor viscous friction constant 0.1 N.m.s
• (Ke) electromotive force constant 0.01 V/rad/sec
• (Kt) motor torque constant 0.01 N.m/Amp
• (R) electric resistance 1 Ohm
• (L) electric inductance 0.5 H

8
Dept. of E&E, MIT Manipal
System Simulation Laboratory

Module II
TUTORIAL 4

Time Domain and Frequency Domain Analysis of


Discrete-time LTI Systems
Objectives:
a. Study of effects of sampling and quantization
b. Time domain representation of discrete-time systems
c. Representation of discrete-time systems using z-Transforms

Effect of sampling and quantization:


1. Sample the analog signal x(t)=3cos(100πt) at i) 400 Hz ii) 100 Hz iii) 75 Hz
iv) x(t)=3cos(100πt) at 75 Hz and v) x(t)=3cos(100πt) at 225 Hz. Plot the
discrete time signal and observe the effect of aliasing.

Demo program
t = 0:.001:0.1;
y = 3*cos (2*50*pi*t);
fc = input (‘Enter the sampling frequency in Hz: ‘);
tc = 1/fc;
tt = 0:tc:0.1; m = max (size (tt));

% Extract sample values here


d = 1e-6;
yy = 3* cos(2*50*pi*tt);
t1(1) = tt(1);y1(1) = yy(1);
t1(2) = tt(1)+d; y1(2) = 0;
indx = 3;

for i = 2:m
t1(indx) = tt(i)-d;
y1(indx) = 0;
t1(indx+1) = tt(i);
y1(indx+1)=yy(i);
t1(indx+2)= tt(i)+d;
y1(indx+2)= 0;
indx = indx+3;
end

plot(t,y,t1,y1,tt,yy),grid
xlabel(‘Time (s)’)
title(‘Signal & its samples’)

9
Dept. of E&E, MIT Manipal
System Simulation Laboratory

disp('strike any key to continue');


pause

indx=3;
ts(1)= tt(1);sa(1)=yy(1);
ts(2)= tt(2);sa(2)=yy(1);

for i= 2:m-1
ts(indx)= tt(i);
sa(indx)= yy(i);
ts(indx+1)= tt(i+1);
sa(indx+1)= yy(i);
indx = indx+2;
end

plot(t,y,ts,sa),grid
xlabel('Time (s)')
title('Signal & zero-order hold')

Results:

The demo program given highlights the effect of sampling.

Case 1: Sampling Frequency = 400 Hz. Observe that the period of


the analog and the discrete time signal as the same.

10
Dept. of E&E, MIT Manipal
System Simulation Laboratory

Re-run the program for the following cases and observe the
results:

Case 2: Sampling Frequency = 100 Hz. Observe that the period of


the analog and the discrete time signal as the same.

Case 3: Sampling Frequency = 75 Hz (i.e., less than Nyquist


sampling rate). Observe that the period of the analog and the
discrete time signal are not the same. Discrete signal frequency
is 25 Hz – less than the actual – aliasing effect.

Case 4: 25 Hz signal sampled at 75 Hz. Observe that the period


of the analog and the discrete time signal as the same. One can
see that the discrete time signal for case 3 & 4 are the same.

Case 5: Sampling Frequency = 225 Hz. Observe that the discrete


time signal obtained is not periodic. Hence if possible, one
should choose the sampling frequency as an integral multiple of
the analog signal.

11
Dept. of E&E, MIT Manipal
System Simulation Laboratory

Time domain response


2. Compute and plot the output response of the LTI system whose impulse
response
h[n] = 1 ; 0≤ n ≤ 4
0 ; otherwise for the input, x[n] = {1 2 4}

Sample Solution
% out_resp.m
x = [1 2 4]; h = [1 1 1 1 1];
y = conv(x,h)
stem(y)

3. For the LTI systems described by the following difference equations, generate its
impulse response, and unit step response.
i. y[n] = x[n] + 2x[n-1]
ii. y[n] = 0.9 y[n-1] + x[n] Also find the analytical expression.
iii. y[n]-0.3695y[n-1]+0.1958y[n-2]=0.2066x[n]+0.4131x[n-1] +0.2066x[n-2]

Sample Solution (iii)


% tf_resp.m
% Time domain response of difference equations
% y[n] – 0.3695 y[n-1]+0.1958y[n-2]=0.2066x[n]+0.4131x[n-
1]+0.2066x[n-2]

b1 = [0.2066 0.4131 0.2066];


a1 = [1 –0.3695 0.1958]; Impulse response
0.6
% Impulse response of the system 0.4
impz(b1,a1,20);
0.2
title(‘Impulse response’);
0

% Step response of the system -0.2


0 2 4 6 8 10 12 14 16 18
step_n = [ones(1,20)]; Step reponse
1.5
y = filter(b1,a1,step_n);
stem(y); 1
title(‘Step response’);
0.5

0
0 5 10 15 20

12
Dept. of E&E, MIT Manipal
System Simulation Laboratory

4. Compute the overall impulse response of the system shown in figure.

h1[n] h2[n]
v(n)
x[n] h4[n] y[n]
y3(n)
h3[n]

h1[n] = (½)n 0 ≤ n ≤ 5
0 otherwise
h2[n] = 1 0≤n≤5
0 otherwise
y3[n] = 0.25 x[n] + 0.5x[n-1] + 0.25 x[n-2]
y[n] = 0.9 y[n-1] – 0.81 y[n-2] + v[n] + v[n-1]

5. A cascade of three LTI systems is shown below

x[n] h1[n] h2[n] h2[n] y[n]

If h2[n] = U[n] – U[n-2] and overall impulse response is {1 5 10 11 8 4 1} starting at n=0,


find h1[n] and verify the result analytically. (use MATLAB function deconv) Also find the
response of the overall system to the input x[n]= δ[n] - δ[n-1].

Transform domain representation

• To enter a transfer function


% Z – domain
% H(z) = (1-5z^(-1)+6z^(-2))/(1-2.5z^(-1)+z^(-2))
b2 = [1 –5 6]; a2 = [1 –2.5 1];
h = [b2,a2];
sys=tf(b2,a2,1e-3)
% To display H(z) as a rational function of ‘z’
printsys(b2,a2,’z’);
• Transfer function to zero-pole conversion (tf2zp)
[z,p,k] = tf2zp(b2,a2)
• To obtain the pole-zero map
zplane(b2,a2);
title(‘ Pole- zero plot of H(z) ‘)
• To find the Partial Fractions of the Transfer function
[r,p,k] = residuez(b2,a2)

13
Dept. of E&E, MIT Manipal
System Simulation Laboratory

6. Transform the system described by y[n]-0.3695y[n-1]+0.1958y[n-2]=0.2066x[n]


+0.4131x[n-1] +0.2066x[n-2] to zero-pole form and residue form. Plot pole-zero
map and comment on stability.
z −1 + 0.5z −2
7. Compute the causal inverse of H ( z ) =
1 − 0.6z −1 +.08z − 2

14
Dept. of E&E, MIT Manipal
System Simulation Laboratory

TUTORIAL 5
Frequency domain response
Objectives:
Frequency domain representation of discrete-time signals – DFS, DTFT, DFT

1. Write a function that can synthesise a waveform in the form


⎧N ⎫
x(t ) = Re ⎨∑ X k e j 2πkfot ⎬ where fo is the fundamental frequency.
⎩ k =1 ⎭
For fo = 25Hz, Xk = j4/kπ for k odd and 0 for k even, plot x(t) for N=5,10 and 25.
Explain what happens when N→∞. repeat the synthesis with fo=1kHz and listen to
the cases N=1,2,3,4,5,10. Ensure that the sampling frequency fs in sound(x,fs) is
high to prevent aliasing.

2. Find the DFS coefficients of the signal x[n]=1+sin(πn/12 + 3π/8)

3. For the LTI systems described by the following difference equations, generate
its frequency response. Comment on the type of response.
i. y[n] = 0.5x[n] + 0.5x[n-1]
ii. y[n] = 0.9 y[n-1] + x[n]
iii. y[n]-0.3695y[n-1]+0.1958y[n-2]=0.2066x[n]+0.4131x[n-1]+0.2066x[n-2]

Sample Solution (iii)


Frequency response
0
% f_resp.m
% Frequency domain response of -20

% difference equations -40

% y[n]–0.3695y[n-1]+0.1958y[n-2] = -60
% 0.2066x[n]+0.4131x[n-1]+ -80
% 0.2066x[n-2] 0 0.2
Magnitude Response
0.4 0.6 0.8 1
Normalized frequency (Nyquist ==

0
b1 = [0.2066 0.4131 0.2066];
-50
a1 = [1 –0.3695 0.1958];
freqz(b1,a1,64); -100

title(‘ Frequency response’) -150


Phase (degrees)
-200
0 0.2 0.4 0.6 0.8 1
Normalized frequency (Nyquist ==

15
Dept. of E&E, MIT Manipal
System Simulation Laboratory

4. Determine and plot the real and imaginary parts and the magnitude and phase
spectra of the following DTFT for various values of r and θ.
1
G (e jω ) = 0< r <1
1 − 2r cos(θ )e − jω + r 2 e − j 2ω
5. Compute and plot the DTFT of the following sequence and observe the
properties s[n]= A cos(2πf0n + φ) Try for fo=100Hz, φ=π/6 and different lengths
of sequence.
6. Three domains: Relation between location of poles and zeroes in z plane,
impulse response and frequency response.
i. y(n) = 0.77y(n-1)+x(n)+x(n-1)
ii. y(n)=0.77y(n-1)+0.77x(n)-x(n-1)
iii. H(z)=1-z-1/1+0.77z-1
iv. H(z)=1-z-1+z-2-z-3+z-4-z-5
v. y(n)=x(n)+x(n-1)+x(n-2)+x(n-3)+x(n-4)+x(n-5)
vi. H(z)=3-3z-1
7. Compute and plot the DFT of the following sequences and observe their
properties
i. Unit impulse signal; xi = {1 0 0 0 0 0 0 0}
ii. All ones; x1 = {1 1 1 1 1 1 1 1}
iii. Three point boxcar; xb = {1 1 1 0 0 0 0 0}
iv. Symmetric boxcar; xbsy = {1 1 0 0 0 0 0 1}

Sample Solution (iv)


% dft.m

N = 8; nn = 0:(N-1); kk = nn;
xb = [1 1 1 0 0 0 0 0];
x(n) Real part of DFT
Xb = fft(xb,N); 1
3
2
subplot(221), stem(nn,xb); 0.5
1
title('x(n)'); xlabel('Index(n)'); 0
axis([0 7 0 1]); 0 -1
0 2 4 6 0 2 4 6
subplot(222), stem(kk,real(Xb)); Index (n) Index (k)
Imag part of DFT
title(' Real part of DFT '); 2

xlabel(' Index (k) '); 1

axis([0 7 -1 4]); 0

subplot(224), stem(kk,imag(Xb)); -1

title(' Imag part of DFT '); -2


0 2 4 6
xlabel(' Index (k) '); Index (k)

axis([0 7 -2 2]);
16
Dept. of E&E, MIT Manipal
System Simulation Laboratory

8. Generate a real-valued test signal v[n] using the MATLAB function rand of
length N=15 or 16. Compute DFT of v[n] to get V[k] and then try the following
for even and odd lengths
a) Compute the even and odd parts of v[n],
ve[n] = 0.5 [v(n) + v[-n mod N] ]
v(-n mod N) = [v(1), v(N:-1:2)]
vo[n] = 0.5 [v[n] - v[-n mod N] ]
b) Compare DFT ve[n] with Re V[k] and DFT vo[n] with Im V[k]

9. Generate a signal s[n] with three sinusoidal components at 50, 120 and 240Hz
corrupted by AWGN. Plot the spectrum and identify the signal components.

Sample Solution:
% ex2_8.m
% identification of sinusoids in noise

fs=2000;
t = (0:199)/fs;
s = sin(2*pi*50.*t) + sin(2*pi*120.*t) +sin(2*pi*240.*t);

awgn = (0.5*randn(1,200)+.25); % N(0.25, 0.25)


sn = s+awgn;
subplot(211), plot(t,sn);
title(' Sinusoid with noise'); grid;

Sn = fft(sn,200);
f = 0:10:990;
sfmag = abs(Sn);
subplot(212), plot(f,sfmag(1:100));
title(' Spectral estimation'); grid;

17
Dept. of E&E, MIT Manipal
System Simulation Laboratory

TUTORIAL 6
Digital Filter Design - FIR Filters
Objectives:
Design of FIR filters using windowing, frequency sampling and Parks McChellan
methods

Filter structures
1. Determine the Cascade and Parallel form structure for the filter with transfer
function
0.44 z 2 + 0.362 z + 0.02
H ( z) = 3
z + 0.4 z 2 + 018
. z − 0.2
2. Determine the lattice form structure for the filter transfer functions given below. Use
MATLAB function poly2rc. Also check the stability of the filters.
. z −1 + 112
a ) H ( z ) = 1 + 12 . z −2 + 012
. z −3 − 0.08z −4
. z −1 + 0.6z − 2
1 + 16
b) H ( z ) =
1 − z −1 − 0.25z − 2 + 0.25z −3
FIR Filters
3. Determine the impulse response of an ideal lowpass filter with linear phase
characteristics. Truncate the impulse response at different lengths, say N=11, 21, 31,
41 and observe the magnitude response of the filters. Gibbs phenomenon
4. Consider a low pass filter with ωp=0.2π and ωs =0.3π. Design a FIR filter using
frequency sampling method. Plot the frequency response of the designed filter and
determine the ripple in the passband (Rp) and minimum stopband attenuation (As).
Try for filter length M=20 and M=40.
5. Design the above filter using Hanning window, Hamming window, Blackmann
window, and Bartlett window. Plot the impulse response, amplitude response and
zero locations of the designed filter and compare their performance.
Characteristics of commonly used window functions
Window function Approximate Transition Exact Transition Minimum stop band
width Δω width Δω attenuation As dB
Rectangular 4π/M 1.8π/M 21
Hamming 8π/M 6.2π/M 44
Hanning 8π/M 6.6π/M 53
Bartlett 8π/M 6.1π/M 25
Blackmann 12π/M 11π/M 74
18
Dept. of E&E, MIT Manipal
System Simulation Laboratory

6. Design a FIR low pass filter of order 20 with the following frequency response
using Remez exchange algorithm
H(ω) = 1; 0 ≤ ω ≤ 0.4π.
0; 0.5π ≤ ω ≤ π.
Problem may be extended for the design of high pass, band pass and band reject
filters.

Sample Solution
% dfd_fir.m
% FIR filter design using Remez Exchange method
n=20 FIR LPF
n = 20; % length of filter 1.2

f = [0 0.4 0.5 1];% filter specs


1
m = [1 1 0 0];
0.8
bfir = remez(n,f,m)
0.6

[hfir,wfir] = freqz(bfir); 0.4


plot(f,m,wfir/pi,abs(hfir),'-');
title(' n=20 FIR LPF'); 0.2

0
0 0.2 0.4 0.6 0.8 1

7. Design a linear phase FIR bandpass filter to satisfy the following specifications:
Passband 8-12 kHz
Stopband ripple 0.001
Peak passband ripple 0.0015
Sampling frequency 44.14 kHz
Transition width 3 kHz
Obtain the filter coefficients and compare the frequency response for the filter using
(a) window method (b) frequency sampling method and (c) optimal method

19
Dept. of E&E, MIT Manipal
System Simulation Laboratory

TUTORIAL 7

Digital Filter Design – IIR Filters

Objectives:
Design of IIR filters using Butterworth, Chebyshev, Elliptical approximations, and
direct method

IIR Filters
• Design an IIR low pass filter with passband edge at 1000Hz and stopband edge at
1500Hz for a sampling frequency of 8000Hz. The filter is to have a passband ripple
of 0.5 dB and a stopband ripple below 30 dB. Plot the frequency response and
compare the performance of the filters designed with Butterworth, Chebyshev I,
Chebyshev II and Elliptic approximations and using both impulse invariant and
bilinear transformations.
• Design an IIR low pass filter for the above specifications using direct method. Use
MATLAB function yulewalk.
• Design a FIR filter for the same specifications and compare the characteristics of
IIR filters with that of FIR filters.
• Design a Chebyshev highpass IIR digital filter with the following specifications:
Passband edge - 12kHz, Stopband edge - 8kHz, Passband ripple - 0.5dB, Stopband
attenuation - 60dB, Sampling frequency - 48kHz.
• Generate a signal s(n) with three sinusoidal components at 5, 15 and 30Hz and
sampled at 100Hz. Design an bandpass elliptic filter to keep the 15Hz sinusoid and
eliminate the 5 and 30Hz harmonics.

Sample Solution
fs=100; t=(1:100)/fs;
s= sin(2*pi*5*t)+sin(2*pi*15*t)+sin(2*pi*30*t);
plot(t,s); grid;
title('Time domain waveform (5,15,30 Hz)');

% Design filter to keep 15 Hz and remove others


wp1=10/50; wp2=20/50; ws1=5/50; ws2=25/50;
wp=[wp1,wp2]; ws=[ws1,ws2]; rp=0.1; rs=40;

[n,wn]=ellipord(wp,ws,rp,rs)

20
Dept. of E&E, MIT Manipal
System Simulation Laboratory

[b,a] = ellip(n,rp,rs,wn);
freqz(b,a);

[H,w] = freqz(b,a);
plot(w*fs/(2*pi),abs(H)); grid;

sf = filter(b,a,s);
subplot(211); plot(t,sf); grid;
title('Filtered signal 15Hz');

S= fft(s,512); SF=fft(sf,512);
f=(0:255)/256*(fs/2);
subplot(212); plot(f, abs([S(1:256)', SF(1:256)'])); grid

• Develop a sine-cosine generator and plot the first 50 samples of its two output
sequences. Scale the outputs so that they both have maximum amplitude of ±1.

• Execute the filtdemo program and study the characteristics of the different filters.

ASSIGNMENT 2

Use FDA Tool for FIR & IIR filter design and analysis

21
Dept. of E&E, MIT Manipal
System Simulation Laboratory

Module III
TUTORIAL 8
Modelling with SIMULINK
Objectives:
Analysis of simple LTI systems using SIMULINK
To analyse systems using LTI Analysis Tool
Armature voltage control of separately exited DC motor using SIMULINK

1. An RLC series circuit with R = 1Ω, L = 1H, & C = 10mF is connected to a dc


source of 10V through a switch. Plot the inductor current and the capacitor
voltage for time, 0 ≤ t ≤ 10s, if the switch is closed at t = 1s & the circuit
elements are initially relaxed.

0.01s
1/s -K- Mux y
0.01s2 +0.01s+1
Step Input Integrator Gain To Workspace
Transfer Fcn Mux

Scope1

2. Compare the step responses of the system given in figure with and without
Proportional Controller. Also analyse the systems using Linear analysis Tool
available in SIMULINK.

R(s) C(s)
s + 50
Kp = 61.4
-
s( s + 10)

1
s + 20

22
Dept. of E&E, MIT Manipal
System Simulation Laboratory

3. Obtain the armature current, speed and torque characteristics of the


separately excited DC motor given with and without current limiter. Two sets
of machine parameters are given.
TL(s)

Ea(s) Ia(s) Tm(s) Wm(s)


1 1
Ki
La s + Ra J m s + Bm
Eb(s)

Kb

ardat1.m
% m/c data – armature control of separately excited dc motor
% Data from text book "Dewan"

global Ir Ea

Ra=0.615; % armature resistance


La=4.5e-3; % leakage inductance of armature
Jm=0.068; % moment of inertia of rotor
Bm=0.83e-3; % damping constant
Ki=1.0712; % torque constant
Kb=Ki; % back emf constant
Tl=20; % rated torque
Ir=19; % rated current
Ea=230; % rated voltage

ardat2.m

% m/c data – armature control of separately excited dc motor


% Data from IEEE Trans on Power Electronics

global Ir Ea

Ra=16.105; % armature resistance


La=0.4549; % leakage inductance of armature
Jm=0.00286; % moment of inertia of rotor
Bm=0.83e-3; % damping constant
Ki=1.42857; % torque constant
Kb=Ki; % back emf constant
Tl=2; % rated torque
Ir=1.4; % rated current
Ea=200; % rated voltage
23
Dept. of E&E, MIT Manipal
System Simulation Laboratory

TL(s)

Ea(s) Ia(s) Tm(s) - Wm(s)


1 1
Ki
- -
La s + Ra J m s + Bm
Eb(s)
curlmt.m
(matlab
function file)

Kb

curlmt.m

%matlab fumction which limits starting current to 2 * rated


value

function Esoft=curlmt(I)
global Ir Ea;
if (I>2*Ir) Esoft = Ea;
else Esoft = 0;
end;

4. Using SIMULINK, solve dynamic characteristics (armature current vs. time &
speed vs. time) of the given armature voltage controlled separately excited DC
motor if
a) The machine is started on no load, by increasing the applied voltage from Ea/4
to rated value (Ea) in steps of Ea/4 with a delay of 0.2 seconds between each
step & after 1 second full load torque is applied.
b) The machine is started on no load by linearly increasing the applied voltage from
zero to rated value (Ea) in 0.5 seconds & after 1 second full load torque is
applied.
Compare the starting current in both cases. Assume rated field excitation. Machine
data given in ardat1.m

ASSIGNMENT 3
Study and apply the following features of SIMULINK in any engineering application.
• Loading & Logging data
• Creating & masking subsystem
• Visualizing results
• Using solvers & Embedded Matlab functions
• Creating libraries and configurable subsystems
24
Dept. of E&E, MIT Manipal
System Simulation Laboratory

Module IV
TUTORIAL 9
Controller Design using Root Locus

Objectives:
To Design P, PI, PD and PID controllers using Root locus.

Controller
R(s) C(s)
Gc (s) G (s)
-

1. Design of Proportional Controller for a unity feedback control system with


K
G ( s) = , design the value of gain K to limit overshoot to 16%.
s ( s + 10)( s + 20)

Procedure (P)
• Obtain the root locus of the given system.
• Find the damping ratio corresponding to 16% OS
• Find the gain at the crossing point of damping ratio line and root locus.
• To check the validity of second order approximation use pole-zero map.

clc;clear;
% program to find the proportional controller
%enter the design specifications and transfer function
num=[1]; den=conv(conv([1 0],[1 10]),[1 20]);
sys1=tf(num,den);
pos=16;

%Obtain the root locus of the uncompensated system.

figure(1)

25
Dept. of E&E, MIT Manipal
System Simulation Laboratory

rlocus(num,den)

%Find the damping ratio corresponds to 16% OS


wn=0;
%z=solve('exp((-z*pi)/(sqrt(1-z^2)))=0.16'); %or
z=(-log(pos/100)/sqrt(pi^2+[log(pos/100)]^2));
sgrid(z,wn);

%Find the gain at the crossing point of damping ratio line and root

locus.

%DOMINANT POLES AND THIRD POLE


[K,P]=rlocfind(sys1);

%to check the compensated system closed loop step response


figure(2)
sys3=feedback(K*sys1,1)
step(sys3)

%To check the validity of second order approximation using pole-zero

map.

figure(3)
pzmap(sys3)

2. Design of PI controller
K
A unity feedback control system with G ( s ) = , is operating
( s + 1)( s + 2)( s + 10)
with a damping ratio of 0.174. Design a PI controller to reduce the steady state
error to zero.

Procedure (PI)
• Evaluate the steady state error performance of the uncompensated system to
determine how much improvement is required.
Obtain the root locus, gain K …etc.
• To make steady state error zero, without affecting the transient response select a
compensator pole at the origin and a zero close to it. Find the transfer function of
controller.
• Find the gain K using the root locus of G(s) * PI sys.
s + zc
PI _ sys = K
s
26
Dept. of E&E, MIT Manipal
System Simulation Laboratory

• Evaluate the performance of compensated system.


K2
• Find the gains K1 & K 2 . (PI controller is of the form K 1 + )
s

3. Design of PD
K
A unity feedback control system with G ( s ) = , is operating with
s ( s + 4)( s + 6)
15% overshoot. Design a PD controller to obtain a threefold reduction in settling
time.

Procedure (PD)
• Evaluate the performance of the uncompensated system to determine how much
improvement in transient response is required.
Obtain the root locus, gain K …etc.
• Design the PD controller to meet the transient response specifications. The design
includes the zero location and gain.
• Find the gain K using the root locus of G(s) * PD_sys.

PD _ sys = K ( s + z c )
• Evaluate the performance of compensated system.
• Find the gains K1 & K 2 . (PD controller is of the form K1 + K 2 s )

4. Design of PID Controller


K ( s + 8)
i. For the unity feedback system with G ( s ) = , design a PID
( s + 3)( s + 6)( s + 10)
controller so that the system can operate with a peak time that is two-thirds that
of the uncompensated system at 20% over shoot and with zero steady state error
for a step input.
ii. Also Design using Ziegler – Nichols method
iii. Use Simulink model and Automatic tuning

Procedure (PID)
• Evaluate the performance of the uncompensated system to determine how much
improvement in transient response is required.
Obtain the root locus, gain K …etc.

27
Dept. of E&E, MIT Manipal
System Simulation Laboratory

• Design the PD controller to meet the transient response specifications. The design
includes the zero location and gain.
• Design the PI controller to yield the required steady state error.
• Find the gain K
• Evaluate the performance of the compensated system.
K
• Find the gains K 1 , K 2 and K 3 ( K1 + 2 + K 3 s )
s
• Evaluate the performance of the compensated system.

rltool: Root Locus Design GUI

ASSIGNMENT 4

For the negative unity feedback system with feed forward transfer function
1
G ( s) = , determine the best choice of parameters for the design of PID
s ( s + 1)( s + 5)
controller by combining Ziegler – Nichols tuning method and SIMULINK auto tuning,
such that the closed loop system has a maximum overshoot below 15% and a settling
time less than 2.5 sec.

28
Dept. of E&E, MIT Manipal
System Simulation Laboratory

TUTORIAL 10
State feedback controllers and observers

Objectives:
To Check Observability & Controllability
Design of linear state feedback controller & full order observer

1. Determine whether the system is observable and state controllable.


⎡ − 2 − 1 − 3⎤ ⎡ 2⎤
⎢ ⎥
x& = ⎢ 0 − 2 1 ⎥ x + ⎢⎢1⎥⎥ u

; y = [4 6 8 ] x
⎢⎣− 7 − 8 − 9⎥⎦ ⎢⎣2⎥⎦

Hint: try with the functions obsv, ctrb, rank, det,


20( s + 5)
2. Given the plant G ( s ) = design the phase variable feedback gains
s ( s + 1)( s + 4)
to yield 9.5% Overshoot and a settling time of 0.74 seconds
clear; clc;
% enter the transfer function
num=20*[1 5]; den=poly([0 -1 -4]);
sys=tf(num,den);
% to get phase variable form
[A B C D]=tf2ss(num,den);
AP=fliplr(flipud(A));
BP=flipud(B);
CP=fliplr(C);
DP=D;
%design specifications
Pos = 9.5;Ts=0.74;
z = (-log(pos/100))/(sqrt(pi^2+log(pos/100)^2));
wn = 4/(z*Ts);
% find the desired pole location
[num,den]=ord2(wn,z);

29
Dept. of E&E, MIT Manipal
System Simulation Laboratory

r=roots(den);
p1= [r(1) r(2) -5];
%design of state feedback gain matrix
K=acker(AP,BP,p1);
Anew=AP-BP*K;
Tss=ss(Anew,BP,CP,DP);

407( s + 0.916)
3. Given the plant G ( s ) = design a full order observer for the
( s + 1.27)( s + 2.69)
phase variables with a transient response described by ζ = 0.7 and ω n = 100
clear; clc;
% enter the transfer function
Num = 407*[1 0.916]; den = poly([-1.27 -2.69]);
Sys = tf(num,den);
% to get phase variable form
[A B C D]=tf2ss(num,den);
AP=fliplr(flipud(A));
BP=flipud(B);
CP=fliplr(C);
DP=D;
%design specifications
z=0.7;
wn=100;
% to Generate continuous- time second order system
[num,den]=ord2(wn,z);
r=roots(den);
p1=[r(1) r(2)];
L=acker(AP',CP',p1)';

4. A boost converter is represented by the following state model


⎡ i&L ⎤ ⎡ 0 − 83.33⎤ ⎡166.67 ⎤ ⎡i ⎤
⎢ ⎥=⎢ ⎥ x+⎢ ⎥ E s y = [0 1] ⎢ L ⎥ i L be the current through the
⎣v&C ⎦ ⎣500 − 10 ⎦ ⎣ 0 ⎦ ⎣v C ⎦
inductor, E S be the dc input voltage and u c the capacitor voltage which is the
converter output. i) design a state feedback controller to obtain 20% overshoot and
a settling time of 0.5second iii) design an observer that should have time constant 10
times smaller than the system with controller.

30
Dept. of E&E, MIT Manipal
System Simulation Laboratory

TUTORIAL 11
System Identification, Design and implementation
of Controllers
Objectives:
To identify system mathematical models using experimental data
Design and implementation of controllers
To practice Hardware in loop simulation of controllers

1. The electric equivalent circuit of the armature voltage controlled DC motor is shown
in Fig. Consider the input of the system to be voltage source (V) applied to the
motor's armature, while the output is the angular velocity . The rotor and shaft are
assumed to be rigid. Also assume a viscous friction model, that is, the friction torque
is proportional to shaft angular velocity. For the given parameter values, obtain a
suitable mathematical model in transfer function form and state space form.
(J) moment of inertia of the rotor 0.01 kg.m^2
(b) motor viscous friction constant 0.1 N.m.s
(Ke) electromotive force constant 0.01 V/rad/sec
(Kt) motor torque constant 0.01 N.m/Amp
(R) electric resistance 1 Ohm
(L) electric inductance 0.5 H

a. Design a suitable controller so that motor should attain the desired speed
within 1% steady state error. Other performance requirement is that the
motor should accelerate to its steady-state speed quickly within 2 seconds
with overshoot less than 5%. Use root locus method and SIMULINK Auto
tuning method for the designer of controller. Verify the performance of the
compensated system.

31
Dept. of E&E, MIT Manipal
System Simulation Laboratory

b. Also design a state feedback controller for the above specifications and
verify the performance of the compensated system. Estimate the states of
the system using a full order observer which is 5 times faster than the
controller.

2. For the cruise control system approximated as mass-damper system as shown in


figure, obtain the mathematical models in transfer function form and state space
form.

.
Bx m u

m=1000kg; B=50Nsec/m;u = 500N


a. Obtain step response and analyze the performance of the system.
b. Design a suitable controller so that when the engine gives a 500 Newton force,
the car should reach a maximum velocity of 10 m/s (22 mph). The automobile
should be able to accelerate up to that speed in less than 5 seconds. 10%
overshoot on the velocity and 2% steady-state error is acceptable. Use root locus
method and SIMULINK Auto tuning method for the designer of controller.
Verify the performance of the compensated system.
c. Also design a state feedback controller for the above specifications and verify
the performance of compensated system.

3. For the RC circuit shown in Fig., obtain the transfer function model and state space
model using system identification method. Derive the model using fundamental
laws and compare the results.
R=10kΩ, C=100 μF,
R

+ Vo
Vi
_ C

32
Dept. of E&E, MIT Manipal
System Simulation Laboratory

• Make the experimental setup and software setup for the Simulink to read the
data and plot the data in real time.
• By applying curve fitting obtain best fit model and also use system identification
toolbox of MATLAB to obtain transfer function and state space model.
• Design a suitable cascade controller to obtain the following specifications using
Root locus method or SIMULINK auto tuning
2% settling time less than 1 second
Peak time less than 0.350 seconds
Maximum overshoot less than 25%
Maximum control effort less than 7 Volts

• Implement the controller using analog circuit components or ICs and verify the
performance

4. For the given DC motor with quadrature encoder, obtain the transfer function model
using system identification techniques. Design a PI / PID controller to obtain the
desired speed characteristics. Perform Hardware in loop simulation for the fine
tuning of controller and hardware execution.

ASSIGNMENT 5
Select a buck or boost converter circuit / suitable IC and obtain the following
• transfer function model and state space model
• Mathematical modelling through system identification techniques.
• Design a PI/PID controller to obtain desired voltage characteristics.
• Implement the controller using analog circuit components
• Perform Hardware in loop simulation for the fine tuning of controller and hardware
execution.
• Implement the system with controller using SIMSCAPE and SIMPOWERSYSTEM
ToolBox.

33
Dept. of E&E, MIT Manipal
System Simulation Laboratory

TUTORIAL 12
Applications

Objective:
Typical DSP applications in power, speech & image signal processing

Power Signal Processing


1. Determine the Fourier series coefficients of the output of a full wave diode rectifier
with and without capacitor filter. Also compute THD.
(Use SimPowerSystems, Power GUI)
2. Load the given data file containing induction motor stator current data for healthy &
faulty conditions. Plot the frequency spectrum and observe the fault signature.

Speech Processing
3. Speech encryption: Compute the FFT of a speech record (block-by block
processing). Modify the FFT by reversing the spectrum (complex, amplitude only,
phase only). Reconstruct the speech using IFFT. Explore the effects of spectrum
manipulation on making the modified speech unintelligible and the quality of the
reconstructed speech.
4. For a voiced frame of 20ms duration, plot the speech spectrum. Model the frame of
speech using an LPC filter and plot the LPC spectrum also. Determine the pitch of
the voice.

% spch_d.m
% Spectral estimation and LPC analysis of speech
Spectrum of A original and lpc model
clear;clc; 50

load mtlb; % load speech 'matlab' 40

t = 0:1/Fs:(length(mtlb)-1)*(1/Fs); 30

plot(t,mtlb); grid; 20

title(' speech signal of the word 10

MATLAB'); 0

xlabel(' time in sec'); -10


ylabel(' signal amplitude'); -20
Magnitude spectrum dB
-30
% extracting samples containing vowel -40
'A' -50
0 500 1000 1500 2000 2500 3000 3500
y = mtlb(1000:1500); frequency in Hz
t1 = t(1000:1500);
subplot(211), plot(t1,y); grid;

34
Dept. of E&E, MIT Manipal
System Simulation Laboratory

title(' section of signal containing A');


xlabel(' time in sec');
ylabel(' signal amplitude');

% Calculate the power spectrum


[p1,f] =psd(y,1024,Fs,400,350);
subplot(212), plot(f, 10*log10(p1)); grid;
title(' Spectrum of A'); xlabel(' frequency in Hz'); ylabel('
Magnitude spectrum dB');

% LPC model estimation


a = lpc(y,14);
H = freqz(1,a,513);
p2 = 10*log10(abs(H).^2); p1 = 10*log10(p1); p3 = p2 - mean(p2-
p1); plot(f,p1,f,p3); grid; axis([0 Fs/2 -50 50]); %
normalisation
title(' Spectrum of A original and lpc model');
xlabel(' frequency in Hz');
ylabel(' Magnitude spectrum dB'); grid;

5. Spectrogram
Plot the spectrogram of a speech record. Use MATLAB function specgram.
6. Design different digital filters, filter the speech file, listen to the filtered speech
and observe the performance of the filters.

Image Signal Processing


7. Display a scanned image using MATLAB and perform basic operations like
image zooming, image resizing, and image rotation.
Use MATLAB functions: load (mat files), bmpread (bmp files), zoom on, imrotate,
imresize
Image files are available in ../matlab/toolbox/matlab/demos
8. Corrupt an image with additive gaussian noise. Filter its rows and columns using
h = [ 1 1 1 1 1]/5 . Use MATLAB functions: imnoise, conv2
9. Try dctdemo
10. Enhance the quality of the given image using contrast stretching and histogram
equalisation. Use MATLAB functions imadjust.

ASSIGNMENT 6
Develop programmes for the implementation of IIR / FIR filters

35
Dept. of E&E, MIT Manipal
System Simulation Laboratory

Appendix

MATLAB Environment

MATLAB® - The Language of Technical Computing


MATLAB is a high-level technical computing language and interactive environment for
algorithm development, data visualization, data analysis, and numeric computation.
Using MATLAB, you can solve technical computing problems faster than with
traditional programming languages, such as C, C++, and Fortran.

You can use MATLAB in a wide range of applications, including signal and image
processing, communications, control design, test and measurement, financial modeling
and analysis, and computational biology. Add-on toolboxes (collections of special-
purpose MATLAB functions, available separately) extend the MATLAB environment
to solve particular classes of problems in these application areas.

MATLAB provides a number of features for documenting and sharing your work. You
can integrate your MATLAB code with other languages and applications, and distribute
your MATLAB algorithms and applications.

36
Dept. of E&E, MIT Manipal
System Simulation Laboratory

Key Features
• High-level language for technical computing
• Development environment for managing code, files, and data
• Interactive tools for iterative exploration, design, and problem solving
• Mathematical functions for linear algebra, statistics, Fourier analysis, filtering,
optimization, and numerical integration
• 2-D and 3-D graphics functions for visualizing data
• Tools for building custom graphical user interfaces
• Functions for integrating MATLAB based algorithms with external applications and
languages, such as C, C++, Fortran, Java, COM, and Microsoft Excel

SIMULINK®
SIMULINK is a platform for multi-domain simulation and Model-Based Design of
dynamic systems. It provides an interactive graphical environment and a customizable
set of block libraries that let you accurately design, simulate, implement, and test
control, signal processing, communications, and other time-varying systems.

Add-on products extend the SIMULINK environment with tools for specific modeling
and design tasks and for code generation, algorithm implementation, test, and
verification.

SIMULINK is integrated with MATLAB, providing immediate access to an extensive


range of tools for algorithm development, data visualization, data analysis and access,
and numerical computation.

Key Features
• Extensive and expandable libraries of predefined blocks
• Interactive graphical editor for assembling and managing intuitive block diagrams
• Ability to manage complex designs by segmenting models into hierarchies of design
components
• Model Explorer to navigate, create, configure, and search all signals, parameters,
and properties of your model

37
Dept. of E&E, MIT Manipal
System Simulation Laboratory

• Ability to interface with other simulation programs and incorporate hand-written


code, including MATLAB algorithms
• Option to run fixed- or variable-step simulations of time-varying systems
interactively or through batch simulation
• Functions for interactively defining inputs and viewing outputs to evaluate model
behavior
• Graphical debugger to examine simulation results and diagnose unexpected
behavior in your design
• Full access to MATLAB for analyzing and visualizing data, developing graphical
user interfaces, and creating model data and parameters
• Model analysis and diagnostics tools to ensure model consistency and identify
modeling errors

38
Dept. of E&E, MIT Manipal
System Simulation Laboratory

Control System Toolbox


The Control System Toolbox builds on the foundation of MATLAB to provide
specialized tools for feedforward and feedback control system modeling, design, and
analysis. Its broad range of capabilities encompasses both classical and modern control
design methods, including root locus, pole placement, and LQG regulator design.
Convenient graphical user interfaces (GUIs) simplify typical control engineering tasks,
saving time and effort.
With the Control System Toolbox, you can model linear-time-invariant (LTI) systems
in transfer function, zero/pole/gain, or state-space form. You can manipulate both
continuous-time and discrete-time systems and convert between various model
representations. The Control System Toolbox allows you to compute and graph time
responses, frequency responses, and root loci.
Like all MathWorks toolboxes, the Control System Toolbox is open and extensible,
allowing you to create custom M-files to suit your particular application or work with
other MathWorks products. The Control System Toolbox allows you to directly import
plant models from the System Identification Toolbox and provides the capability to
import a control system design into SIMULINK for integration into larger simulation
models.
Key Features
• LTI Viewer, an interactive GUI for analyzing and comparing linear-time-invariant
(LTI) systems
• Time domain step, impulse, and pole/zero plots and frequency domain responses
(Bode, Nyquist, and Nichols) in one window
• SISO Design Tool, an interactive GUI for analyzing and tuning single-input/single-
output (SISO) control systems using root locus, Bode, and Nichols plots
• Graphical compensator performance constraints in the SISO Design Tool
• Interactive closed loop response plot updates continuously as the compensator is
modified in the SISO Design Tool
• Design session loading and saving features including archive of multiple
compensator designs
• Preference and property settings giving the user complete control over the
visualization of time and frequency plots
39
Dept. of E&E, MIT Manipal
System Simulation Laboratory

• Specialized data structures, called LTI objects, for concisely representing transfer
function, state-space, zero/pole/gain, and frequency response data model formats
• Support for multi-input/multi-output (MIMO) systems, continuous-time and
sampled-data systems, and systems with time delays
• Support for a variety of discrete-to-continuous conversion methods
• Tools for modern control design techniques, including pole placement, LQR/LQG
regulation, Kalman filter design, determining controllability and observability, and
solutions to the Riccati and Lyapunov equations

Signal Processing Toolbox


The Signal Processing Toolbox is a collection of industry-standard algorithms for
analog and digital signal processing. It provides graphical user interfaces (GUIs) for
interactive design and analysis and command-line functions for advanced algorithm
development.
Most toolbox functions are implemented in the open MATLAB language. This means
that you can inspect the algorithms, modify the source code, and create your own
custom functions. You can use the toolbox for applications such as speech and audio
processing, wired and wireless communications, financial modeling and analysis, and
medical imaging and instrumentation.

Key Features
• Comprehensive set of signal and linear system models
• Tools for finite impulse response (FIR) and infinite impulse response (IIR) digital
filter design, analysis, and implementation
• Tools for analog filter design
• Access to the most widely used transforms, such as fast Fourier and discrete cosine
• Tools for spectral analysis and statistical signal processing
• Functions for parametric time-series modeling
• Routines for waveform generation, including a Gaussian pulse generator, a periodic
sinc generator, and a pulse train generator
• Extensive data windowing algorithms
• Graphical user interfaces for designing, analyzing, and visualizing signals, filters,
and windows

40
Dept. of E&E, MIT Manipal
System Simulation Laboratory

SimPowerSystems
SimPowerSystems extends SIMULINK® with tools for modeling and simulating basic
electrical circuits and detailed electrical power systems. These tools let you model the
generation, transmission, distribution, and consumption of electrical power, as well as
its conversion into mechanical power. SimPowerSystems is well suited to the
development of complex, self-contained power systems, such as those in automobiles,
aircraft, manufacturing plants, and power utility applications.
Together, SimPowerSystems and SIMULINK provide an efficient environment for
multi domain modeling and controller design. By connecting the electrical parts of the
simulation to other SIMULINK blocks, you can rapidly draw the circuit topology and
simultaneously analyze the circuit’s interactions with mechanical, thermal, and control
systems.
The block libraries and simulation methods in SimPowerSystems were developed by
TransÉnergie Technologies Inc. of Montreal.

Key Features
• Enables electrical circuit modeling and simulation using standard symbols
• Provides comprehensive block libraries for building detailed power system models
• Provides detailed models of common AC and DC electric drives
• Draws on SIMULINK solver technology to deliver highly accurate simulations
• Uses discretization and phasor simulation modes to speed model execution and
enable real-time execution
• Provides analysis methods to obtain state-space representations of circuits, compute
load flow for machines, and work with currents and voltages

For more on MATLAB environment refer www.mathworks.com

41
Dept. of E&E, MIT Manipal

Das könnte Ihnen auch gefallen