0% found this document useful (0 votes)
161 views24 pages

DLS - Lab Manual PDF

This laboratory manual outlines experiments to generate and analyze various continuous and discrete time signals using MATLAB. The experiments include generating impulse, step, ramp, parabolic, sinusoidal, exponential, and damped sinusoidal signals. It also covers the discrete and continuous convolution of sequences and signals. Properties of convolution such as commutativity, associativity, and distributivity are demonstrated with examples. Students are assigned to calculate signal parameters, generate signals with different amplitudes and frequencies, determine the time constant of an exponential, and convolve polynomials.

Uploaded by

Nitin Prajapati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
161 views24 pages

DLS - Lab Manual PDF

This laboratory manual outlines experiments to generate and analyze various continuous and discrete time signals using MATLAB. The experiments include generating impulse, step, ramp, parabolic, sinusoidal, exponential, and damped sinusoidal signals. It also covers the discrete and continuous convolution of sequences and signals. Properties of convolution such as commutativity, associativity, and distributivity are demonstrated with examples. Students are assigned to calculate signal parameters, generate signals with different amplitudes and frequencies, determine the time constant of an exponential, and convolve polynomials.

Uploaded by

Nitin Prajapati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Laboratory Manual

Subject: Dynamics of Linear Systems (3131705)


Semester: III
Department of Instrumentation and Control
Vishwakarma Govt. Engg. College. Chandkheda.
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Practical: 1

Aim: Generate an impulse, step, and square waveforms in continuous and discrete domain.

Impulse Signal: (Continuous Time)

MATLAB CODE: MATLAB PLOT:

t = (-1:0.05:1);
impulse = t==0;
plot(t,[impulse]);
xlabel('Time')
ylabel ('Magnitude')
title ('Unit Impulse')

Step Signal: (Continuous Time)

t = (-1:0.05:1);
unitstep = t>=0;
plot(t,[unitstep]);
xlabel('Time')
ylabel ('Magnitude')
title ('Unit Step')

2
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Ramp Signal: (Continuous Time)

t = (-1:0.05:1);
unitstep = t>=0;
ramp = t.*unitstep;
plot(t,[ramp]);
xlabel('Time')
ylabel ('Magnitude')
title ('ramp')

Parabolic Signal: (Continuous Time)

t = (-1:0.05:1);
unitstep = t>=0;
parabolic = t.^2.*unitstep;
plot(t,[parabolic]);
xlabel('Time')
ylabel ('Magnitude')
title ('parabolic')

Impulse Signal:(Discrete Time)

t = (-1:0.05:1)';
impulse = t==0;
stem ([impulse]);
xlabel('Time')
ylabel ('Magnitude')
title ('Unit Impulse')

3
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Unit Step Signal Discrete Time)

t = (-1:0.05:1)';
unitstep = t>=0;
stem ([unitstep]);
xlabel('Time')
ylabel ('Magnitude')
title ('Unit Step')

Square Wave: (Continuous Time)


t = (-1:0.01:1)';
sqwave =
0.81*square(4*pi*t);
plot(t,sqwave)

Square Wave: (Discrete Time)


t = (-1:0.05:1)';
sqwave =
0.81*square(4*pi*t);
stem(t,sqwave)
xlabel('Time')
ylabel ('Magnitude')
title ('Square Wave')

4
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Assignment:

(1) List and explain in Brief the Commands of MATLAB used to generate different Signals in this
practical.
(2) List out Properties of Continuous and Discrete Time Signals Properties.
(3) Generate Signals with different magnitude and frequencies using MATLAB, Attach their Code
and Plot Figure with this Assignment.

5
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Practical: 2

Aim: Generate sinusoidal waveforms of different frequencies in continuous and discrete domain.
Understand the difference between CT and DT waveforms.

Sine Wave:
• Frequency: 60 Hz.
• One Cycle: 1/60 =0.0166 seconds
• Radian Frequency: 2*pi*60

MATLAB CODE: (C.T.) MATLAB CODE: (D.T.)

t = 0:1/2000:.05; t = 0:1/2000:.05;
x = sin(2*pi*60*t); % approx. to x = sin(2*pi*60*t); % approx. to
continuous-time continuous-time
axis([0 0.05 -1 1]); axis([0 0.05 -1 1]);
plot(t,x) stem(t,x)
xlabel('Time') xlabel('Time')
ylabel ('Magnitude') ylabel ('Magnitude')
title ('Sine Wave') title ('Sine Wave')

Assignment:

(1) Calculate Amplitude and Frequency ( in Hz and Rad/Sec) for the above example.
(2) Generate Sine Wave for
(1) Amplitude: 3.5 Peak, Frequency: 100 Hz
(2) Amplitude: 5 Peak To Peak, Frequency: 250 Rad/Sec
(3) Amplitude: 1000 Peak, Frequency: 2000 Rad/Sec

6
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Practical: 3

Aim: Generate growing exponential, decaying exponential and exponentially damped sinusoidal signals.

Exponential Signal

Decaying Exponential: Growing Exponential:

𝒙 = 𝑩. 𝒆−𝒂𝒕 𝒙 = 𝑩. 𝒆𝒂𝒕

MATLAB CODE: MATLAB CODE:

B=5; B=5;
a=6; a=6;
t=0:.001:1; t=0:.001:1;
x=B*exp(-a*t); x=B*exp(a*t);
plot(t,x) plot(t,x)
xlabel('Time'); xlabel('Time');
ylabel ('Magnitude'); ylabel ('Magnitude');
title ('Decaying Exponential'); title ('Growing Exponential');

Decaying Damped Sinusoid:

𝒙 = 𝑨 𝒔𝒊𝒏(𝝎𝟎 𝒕 + ∅) 𝒆−𝒂𝒕

MATLAB CODE:

A = 60;
w0 = 20*pi;
phi = 0;
a = 6;

t = 0:.001:1;
7
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

expsin = A*sin(w0*t + phi).*exp(-a*t);


plot(t, expsin);
xlabel('Time')
ylabel ('Magnitude')
title ('Decaying Damped Sinusoid')

Assignment:

(1) Calculate Time Constant of the Exponential from Plot for above example.
(2) Generate Decaying Exponential for RC Circuit using Network Equation.
(3) Generate Growing Damped Sinusoid and show its plot.

8
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Practical: 4

Aim: Find the discrete/continuous convolution between two sequences/signals. Verify the commutative,
distributive and associative properties of convolution.

Convolution: x [n] * h [n] = y [n]

Examples:

1. Create vectors u and v containing the coefficients of the polynomials x2+1 and 2x+7.

Matlab Code Matlab Plot


u = [1 0 1];
v = [2 7];
w = conv (u, v);
subplot(4,1,1);
stem(u,'linewidth', 2);
xlabel('time');
ylabel('u');
subplot(4,1,2);
stem(v,'linewidth', 2);
xlabel('time');
ylabel('v');
subplot(4,1,3);
stem(w,'linewidth', 2);
xlabel('time');
ylabel('w');

Here Convolution of signals u and v will results in w as,

w = 1×4
2 7 2 7
w contains the polynomial coefficients for 2x3+7x2+2x+7. The same is shown in plot:

Properties of Convolution:

• Commutative: a [n] ∗ b [n] = b [n] ∗ a [n]


• Associative: {a [n] ∗ b [n]} ∗ c [n] = a [n] ∗ {b [n] ∗ c [n]}
• Distributive: a [ n ] ∗ b [ n] + a [ n ] ∗ c [ n] = a [ n ] ∗ { b [ n] + c [ n]}

9
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

These properties are explained here with examples:

Commutative: u [1 0 1] ∗ v [2 7] = v [2 7 ] ∗ u [1 0 1]

Matlab Code Matlab Plot

u = [1 0 1];
v = [2 7];
w = conv (v, u);
subplot(4,1,1);
stem(u,'linewidth', 2);
xlabel('time');
ylabel('u');
subplot(4,1,2);
stem(v,'linewidth', 2);
xlabel('time');
ylabel('v');
subplot(4,1,3);
stem(w,'linewidth', 2);
xlabel('time');
ylabel('w');

Associative: { u [1 1] ∗v [1 2] } ∗ w[1 3] = u[1 1] ∗ {v[1 2] ∗ w[1 3] }

u= x+1 Matlab Plot:


v= x+2
w= x+3

Matlab Code:
u = [1 1];
v = [1 2];
w = [1 3];
x = conv (u, v);
y = conv (x, w);
z = conv (v, w);
a = conv (u, z);
subplot(5,1,1);
stem(u, 'linewidth', 2);
xlabel('time');
ylabel('u');
subplot(5,1,2);
stem(v,'linewidth', 2);
xlabel('time');
ylabel('v');
10
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

subplot(5,1,3);
stem(w,'linewidth', 2);
xlabel('time');
ylabel('w');
subplot(5,1,4);
stem(y,'linewidth', 2);
xlabel('time');
ylabel('y');
subplot(5,1,5);
stem(a,'linewidth', 2);
xlabel('time');
ylabel('a');

Distributive: a∗b+a ∗c=a∗{b+c}


a = x+1
b = x+2
c = x+3

Matlab Code: Matlab Plot:


a = [1 1];
b = [1 2];
c = [1 3];
d = conv (a, b);
e = conv (a, c);
f = d + e;
g = b + c;
h = conv (a,g);
subplot(5,1,1);
stem(a, 'linewidth', 2);
xlabel('time');
ylabel('a');
subplot(5,1,2);
stem(b,'linewidth', 2);
xlabel('time');
ylabel('b');
subplot(5,1,3);
stem(c,'linewidth', 2);
xlabel('time');
ylabel('c');
subplot(5,1,4);
stem(e,'linewidth', 2);
xlabel('time');
ylabel('e');
subplot(5,1,5);
stem(h,'linewidth', 2);
xlabel('time');
ylabel('h');

11
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Practical: 5

Aim: Perform folding, shifting and scaling on a given signal x (t) to obtain a signal of the form x(at+b).

Folding of Signal:
Matlab Code:
x=input('enter the sequence'); Input
a=length(x); Signal : [1 2 3 4 -1 -2 -3 -4]
n=1:1:a;
subplot(2,1,1); Output
stem(n,x); Folded signal: [-4 -3 -2 -1 4 3 2 1]
xlabel('number of samples');
ylabel('amplitude');
title('input signal');
m=-a:1:-1;
y=x(a-n+1);
subplot(2,1,2);
stem(m,y);
xlabel('number of samples');
ylabel('amplitude');
title('folded signal');
display(x);
display(y);
display(n);
display(m);

Output Plot

12
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Time Shifting of Signal:


Matlab Code:
n1=input('Enter the amount to be delayed'); Signal Delay: 2
n2=input('Enter the amount to be advanced');
n=-2:2; Signal Advance: 3
x=[-2 3 0 1 5];
subplot(3,1,1);
stem(n,x);
title('Signal x(n)');
m=n+n1;
y=x;
subplot(3,1,2);
stem(m,y);
title('Delayed signal x(n-n1)');
t=n-n2;
z=x;
subplot(3,1,3);
stem(t,z);
title('Advanced signal x(n+n2)');

Output Plot:

13
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Time Scaling of Signal


Matlab Code: Output Plot:

t = (-1:0.01:1)';
impulse = t==0;
unitstep = t>=0;
ramp = t.*unitstep;
ramp2 = 2.*t.*unitstep;
plot(t,[ramp ramp2])

Signal X(t) to X(at+b) Operation:


x = sin(2*pi*60*t) to y = sin(2*pi*60*a*t + b)
Matlab Code: Matlab Plot

t = 0:1/20000:.03;
a = 2;
b = 0.0166;
x = sin(2*pi*60*t); % approx. to
continuous-time
y = sin(2*pi*60*a*t + b);
axis([0 0.06 -1.5 1.5]);
subplot(211);
plot(t,x);
xlabel('Time')
ylabel ('x = sin(2*pi*60*t)')
title ('x(t)')
subplot(212);
plot(t,y);
xlabel('Time')
ylabel ('y = sin(2*pi*60*a*t + b)')
title ('x(at +b)')

14
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Practical: 6

Aim: Find the output of the system with given input (e.g. x[n]=2 {u[n+2] – u[n-12]}) and given impulse
response ( e.g. h[n]= 0.9n {u[n+2] – u[n-12] }.

Matlab Code: Output Plot

t =-5:0.8:20
v = 2.*(heaviside(t+2)-heaviside(t-
12));
h = (0.9).^t.*(heaviside(t+2)-
heaviside(t-12));
subplot(311);
stem(v,'linewidth',1);
xlabel('Time')
ylabel ('v')
title ('signal')
subplot(312);
stem(h,'linewidth',1);
xlabel('Time')
ylabel ('h')
title ('impulse')
y=conv(v,h);
subplot(313);
stem(y,'linewidth',1);
xlabel('Time')
ylabel ('y')
title ('output')

15
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Practical: 7

Aim: Obtain the impulse response h[n] of the systems.

A discrete time system is described by the following difference equation


y[n] = 1.15y[n − 1] − 1.5y[n − 2] + 0.7y[n − 3] − 0.25y[n − 4] + 0.18x[n] + 0.1x[n − 1] +
0.3x[n − 2] + 0.1x[n − 3] + 0.18x[n − 4]
with zero initial conditions.
Y(z) can be rewritten as..

Compute and plot the impulse response h[n], 0 ≤ n ≤ 40 using the function h = impz(b, a, N).

Matlab Code:

xn = ones(1,41);
num = [0.18 0.1 0.3 0.1 0.18];
den = [1 -1.15 1.15 -0.7
0.25];
hn = impz(num, den, 41);
stem([0:40], hn);

16
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Practical: 8

Aim: Compute FT and DTFT of the continuous time signals and discrete time sequences.

Determine the discrete time Fourier transform of x(𝑛) = 0.5𝑛 𝑢(𝑛). Evaluate (𝑒𝑗𝜔) at 501 equispaced points
between [0,π] and plot its magnitude, angle, real, and imaginary parts.
Signal is : x(𝑛) = 0.5𝑛 𝑢(𝑛)
The discrete time fourier transform of signal is:

Signal is : x(𝑛) = 0.5𝑛 𝑢(𝑛)

Its Representation is as shown:

Matlab Code:

n=[-0.000001:0.1:30];
x=0.5.^n.*(heaviside(n));
plot(n,x);

It is clear from the signal plot, that it is exponentially decaying with rate of 0.5^n.

17
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Now, the signal discrete fourier


transform as:

Matlab Code: Plot:

w=[0:1:500]*pi/500;
X= exp(j*w) ./ (exp(j*w) -
0.5*ones(1,501));
magX = abs (X);
angX = angle(X);
realX = real(X);
imagX = imag(X);
subplot(2,2,1);
plot(w/pi, magX); grid
xlabel('frequency in pi units');
title('Magnitude Part');
ylabel('Magnitude');
subplot(2,2,3);
plot(w/pi, angX); grid
xlabel('frequency in pi units');
title('Angle Part');
ylabel('Radians');
subplot(2,2,2);
plot(w/pi, realX); grid
xlabel('frequency in pi units');
title('Real Part');
ylabel('Real');
subplot(2,2,4);
plot(w/pi, imagX); grid
xlabel('frequency in pi units');
title('Imaginary Part');
ylabel('Imaginary');

18
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Practical: 9

Aim: Find the partial fraction expansion of the given z-transform.

Syntax Used:

[ro,po,ko] = residuez(bi,ai)
[bo,ao] = residuez(ri,pi,ki)

[ro,po,ko] = residuez(bi,ai) Finds the residues, poles, and direct terms of a partial fraction
expansion of the ratio of numerator and denominator
polynomials, b and a.

[bo,ao] = residuez(ri,pi,ki) With three input arguments and two output arguments, converts the
partial fraction expansion back to polynomials with coefficients in row
vectors b and a.
Example: Compute the partial-fraction expansion corresponding to the third-order IIR low pass filter
described by the transfer function.

• Express the numerator and denominator as polynomial convolutions.


• Compute the residues, poles, and direct terms of the partial-fraction expansion.

Matlab Code: Plot:

b0 = 0.05634;
b1 = [1 1];
b2 = [1 -1.0166 1];
a1 = [1 -0.683];
a2 = [1 -1.4461 0.7957];
b = b0*conv(b1,b2);
a = conv(a1,a2);
[r,p,k] = residuez(b,a)
zplane(b,a);
hold on
plot(p,'^r')
hold off
[bn,an] = residuez(r,p,k)

19
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Residuez returns r=roots, p=poles and k=constants representing partial fraction expansion.

r =

-0.1153 - 0.0182i
-0.1153 + 0.0182i
0.3905 + 0.0000i

p =

0.7230 + 0.5224i
0.7230 - 0.5224i
0.6830 + 0.0000i

k =

-0.1037

20
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Practical: 10

Aim: Given an LTI system with transfer function, plot its (i) pole-zero plot in the z-plane and (ii) frequency
response.

Given that

is a causal system, find


a. its transfer function representation,
b. its difference equation representation, and
c. its impulse response representation.

The poles of the system function are at z = 0.9_ ± π/3. Hence the ROC of this causal system is |z| > 0.9. Therefore

the unit circle is in the ROC, and the discrete-time Fourier transform H(e ) exists.

21
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Matlab Code Plot

w=[0:1:500]*pi/500;
b = [0,1,1];
a = [1,-0.9,0.81];
[R,p,C]= residuez(b,a)
[H,w] = freqz(b,a,100);
subplot(3,1,1);
zplane(b,a);
hold on
plot(p,'^r'); grid
title('Pole-Zero')
hold off
magH = abs(H);
phaH = angle(H);
subplot(3,1,2);
plot(w/pi,magH);grid
xlabel('frequency in pi
units');
ylabel('Magnitude');
title('Magnitude Response')
subplot(3,1,3);
plot(w/pi,phaH/pi);grid
xlabel('frequency in pi
units');
ylabel('Phase in pi
units');
title('Phase Response')

22
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

Practical: 11

Aim: Convert pole-zero gain form of z-transform to second order systems.

1. Convert the transfer function

h = tf([-10 20 0],[1 7 20 28 19 5]);

to zero-pole-gain form, using: zpk(h)

This command returns the result:

Zero/pole/gain:

-10 s (s-2)
----------------------
(s+1)^3 (s^2 + 4s + 5)

2. Specify the following one-input, two-output zero-pole-gain model:

To do this, enter:

Z = {[] ; -0.5};
P = {0.3 ; [0.1+i 0.1-i]};
K = [1 ; 2];
H = zpk(Z,P,K,-1); % unspecified sample time

3. Create a discrete-time ZPK model from a rational expression in the variable z.


z = zpk('z',0.1);
H = (z+.1)*(z+.2)/(z^2+.6*z+.09)

This command returns the following result:

Zero/pole/gain:

(z+0.1) (z+0.2)
---------------
(z+0.3)^2

Sample time: 0.1

23
Vishwakarma Government Engineering College
Department of Instrumentation and Control Engineering
Laboratory Manual
Sem: III Subject : Dynamics of Linear Systems (3131705)

4. Create a MIMO zpk model using cell arrays of zeros and poles.
Create the two-input, two-output zero-pole-gain model.

by entering:

Z = {[],-5;[1-i 1+i] []};

P = {0,[-1 -1];[1 2 3],[]};

K = [-1 3;2 0];

H = zpk(Z,P,K);

Use [] as a place holder in Z or P when the corresponding entry of H(s) has no zeros or poles.

24

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy