You are on page 1of 16

Jawaharlal Nehru Engineering College

Laboratory Manual

SIGNALS & SYSTEMS

For

Third Year Students

Prepared By: Ms.Sunetra S Suvarna


Assistant Professor

 Author JNEC INSTRU. & CONTROL DEPT., Aurangabad


SUBJECT INDEX

Title

1.Do’s and Don’ts in Laboratory

2 .Instruction for Laboratory Teachers:

3. Lab Exercises

1. Generation of discrete time signals


2. Verify properties of linear convolution (any two)
3. Sampling of a continuous time signal and effect of under sampling
4. Frequency response of discrete time system using D.T.F.T.
5. Auto-correlation and Cross-correlation of discrete time sequences
6. Program for calculating Inverse z-transform
7. Program for Probability density function
8. Discrete time sinusoidal amplitude modulation

4. Quiz for the subject

5. Conduction of viva voce examination

6. Evaluation and marking scheme


1. DOs and DON’Ts in Laboratory:

1. Do not handle DSP Starter kit without reading the instructions/Instruction manuals.
2. Refer Matlab Help for debugging the program.
3. Go through Matlab Demos of Signal Processing tool box.
4. Strictly observe the instructions given by the teacher/Lab Instructor
.

2 Instruction for Laboratory Teachers::

1. Lab work completed during prior session ,should be corrected during the next lab session.

2. Students should be guided and helped whenever they face difficulties.

3. The promptness of submission should be encouraged by way of marking and evaluation patterns
that will benefit the sincere students.
Lab Exercises:

Exercise No 1 : ( 2 Hours) – 1 Practical


Aim: Generation of discrete time signals
a)Sinusoidal
b) Step
c) Ramp
d) Impulse
e) Real valued
f) Complex valued

These are the basic discrete signals. Plot all the signals.
Lab Exercises:

Exercise No 2 : ( 2 Hours) – 1 Practical


Aim: Program for Convolution two signals

% The input sequence is denoted by x(n) and impulse response h(n) are convoluted
%and the resultant signal is obtained .This technique illustrates how a filter can be
%implemented in time domain
%The convolution is given by

%Y(k) = ∑ x(k) . h(n-k) for all k
n=-∞

% Implement the equation on 4_ point (or variety) x(n) & h(n) and display y(n)

Algorithm:

To find the convolution following steps has to be followed


1.Enter the of input sequence x(n) & impulse response sequence h(n)
2. Define the limits from sequence
3.findout starting point for convolution from sequence.
4.Define the length of sequence
5. Plot the convolution for different inputs.

Program:

%Illustration of convolution
x=input('type the input sequence');
h=input('type the impulse response');
y=conv(x,h);
m=length(y)-1;
n=0:1:m;
disp('output sequence');
disp(y);
stem(n,y)
xlabel('Time index');
ylabel('Amplitude');
%Another sample program for convolution where in time reference is also displayed.
%Illustration of convolution
nx=[-1:2];
x=input('type the input sequence');
nh=[1:4];
h=input('type the impulse response');
nyb=nx(1)+nh(1);
nye=nx(length(x))+nh(length(h));
ny=[nyb:nye];
y=conv(x,h);
disp(y);
stem(ny,y)
xlabel('Time index');
ylabel('Amplitude');
Result:

Enter the input sequence x(n): [1 2 3 4 5]


Enter the impulse responce sequence h(n): [1 2]

input sequence x(n)


1 2 3 4 5

impulse response h(n) 1 2

output of discrete LTI System is 1 4 7 10 13 10

Press "ENTER" for input sequence x(n)


Press "ENTER" for impulse response h(n)

Press "ENTER" for response of the system


Lab Exercises:

Exercise No 3 : ( 2 Hours) – 1 Practical

Aim: Frequency response of discrete time system using D.T.F.T.

%The DTFT analysis equation. In this equation x[n] is time domain signal wit n running from0 to N-1.The

frequency spectrum is held in: ℜ X (ω ) and ℑ X ( ω) , with ω between 0 and pi.


+∞
ℜ X ( ω )= ∑ x [ n ] cos ( ωn )
n=−∞
and
+∞
ℑ X ( ω )=− ∑ x [ n ] sin ( ωn )
n =− ∞

% The DTFT synthesis equation


ωn
ωn
( )dω
ReX ( ω ) cos( )− ImX ( ω ) sin
π
1
x [ n ]= ∫ ❑
π 0

Algorithm:
To find frequency response of discrete time system using DTFT following steps has to be followed:
1.Compute the frequency sample of of the DTFT.
2.Define num and den co-efficient of DTFT
3. Find frequency response of DTFT.
4. Plot the DTFT.

Program:

% Evaluation of the DTFT


clf;
% Compute the frequency samples of the DTFT
w = -4*pi:8*pi/511:4*pi;
num = [2 1];den = [1 -0.6];
h = freqz(num, den, w);
% Plot the DTFT
subplot(2,1,1)
plot(w/pi, real(h));grid
title('Real part of H(e^{j\omega})')
xlabel('\omega /\pi');
ylabel('Amplitude');
subplot(2,1,2)
plot(w/pi,imag(h));grid
title('Imaginary part of H(e^{j\omega})')
xlabel('\omega /\pi');
ylabel('Amplitude');
pause
subplot(2,1,1)
plot(w/pi,abs(h));grid
title('Magnitude Spectrum |H(e^{j\omega})|')
xlabel('\omega /\pi');
ylabel('Amplitude');
subplot(2,1,2)
plot(w/pi,angle(h));grid
title('Phase Spectrum arg[H(e^{j\omega})]')
xlabel('\omega /\pi');
ylabel('Phase in radians');
Lab Exercises:

Exercise No 4 : ( 2 Hours) – 1 Practical


Aim: Sampling of a continuous time signal and effect of under sampling.

Algorithm:

To find sampling of continuous time signal following steps has to be followed:


1. Define the sampling frequency ,Fs=100 Hz
2. Plot them in continues-time form.
3. Observe and note the alising effect.
4. Plot the graph

Program:

Fs = 100; % sampling frequency


% change sampling frequency to observe the effects of under sampling
% (Aliasing) and over sampling
f=10;
% change signal frequency and analyze the output
Tmax = 10;
time = 0:1/Fs:Tmax;
omega = 2*pi*f; % signal frequency f Hz
signal = 10*sin(omega*time) + rand(1,Tmax*Fs+1);
Nfft = 2^8;
[Pxx,freq] = pwelch(signal,Nfft,[],[],Fs)%computing power spectral density
plot(freq,Pxx)
xlabel('frequency in hz');
ylabel('power P')
title('Signal PSD')
% frequency domain view
% Compute the frequency response
w1=-Fs/2:Fs/1024:(Fs/2)-1/1024
S = fftshift(fft(signal,1024));
figure
plot(w1,abs(S));grid
xlabel('Frequency in hz');
ylabel('Signal Amplitude A')
Lab Exercises:

Exercise No 5 : ( 2 Hours) – 1 Practical


Aim: Program for autocorrelation and cross correlation of two signals

Algorithm:

To find the cross and Auto correlation following steps has to be followed:
1.Enter the length of sequence reference and second sequence
2.Define the length of sequence both
3. Plot the cross correlation for different inputs
4.follow the same steps foe auto correlation

Program:

%computation of cross correlation sequence


x=input('type in the reference sequence=');
y=input('type in the second sequence=');
%compute the correlation sequence
n1= length(y)-1;
n2= length(x)-1;
r=xcorr(x,y);% here the length of x= length of y
%r=conv(x,fliplr(y));
%k=(-n1):n2';
stem(r);

%computation of auto correlation of a sequence


x=input('type in the reference sequence=');
%compute the correlation sequence
%r=xcorr(x);
r=conv(x,fliplr(x));
stem(r);
Lab Exercises:

Exercise No 6 : ( 2 Hours) – 1 Practical


Aim: Program for calculating Inverse z-transform

% The Transfer function is given by

Algorithm:

To find the solution of given transfer function following steps has to be followed
1. Enter the numerator and denominator of the sequence
2. Define the order of transfer function
3. Specify the method of calculating Z transform i.e. inverse z- transform method
4. Follow the same steps foe calculating z transform for other methods.

Program:

format long
n=input('type length of o/p vector =');
num=input('type num cooef=');
den=input('type den cooef=');
x=[1 zeros(1,n-1)]
y=filter(num,den,x);
disp('coeff of pse =');
disp(y);
Lab Exercises:

Exercise No 7 : ( 2 Hours) – 1 Practical

Aim: Program for Probability density function.

The discrete binomial pdf

assigns probability to the event of k successes in n trials of a


Bernoulli process (such as coin flipping) with probability p of success at each trial. Each of the
integers k = 0, 1, 2, ..., n is assigned a positive probability, with the sum of the probabilities equal to 1.
Compute the probabilities with the binopdf function:

Algorithm:
To find probability density function following steps has to be followed:

Program:

p = 0.2; % Probability of success for each trial


n = 10; % Number of trials
k = 0:n; % Outcomes
m = binopdf(k,n,p); % Probability mass vector
bar(k,m) % Visualize the probability distribution
set(get(gca,'Children'),'FaceColor',[.8 .8 1])
grid on
Lab Exercises:

Exercise No 8 : ( 2 Hours) – 1 Practical

Aim: Discrete time sinusoidal amplitude modulation.

Algorithm:
To find the sinusoidal amplitude modulation following steps has to be followed:

Program:

close all;
clc;
t=0:0.01:10;
f=0.01;
a=cos(2*pi*f*t);
subplot(3,1,1);
plot(t,a);
xlabel('time-->');
ylabel('amplitude-->');
title('modulating Waveform');
f=0.1;
b=sin(2*pi*f*t);
subplot(3,1,2);
plot(t,b);
xlabel('time-->');
ylabel('amplitude-->');
title('sine-wave carrier Waveform');
c=a.*b;
subplot(3,1,3);
plot(t,c);
xlabel('time-->');
ylabel('amplitude-->');
title('modulated Waveform')
4. Quiz on the subject:

1).--------Signals are the signals repeating after specific period.

a] Energy
b] Digital
c] Periodic

2) The system is said to be ------- or to have memory.

a] Dynamic
b] Recursive
c] Stable

3) If y(n) = nx(n) then the system is

a] Causual
b] Recursive
c] dynamic

4) If the signal is infinite duration and both sided then its ROC is

a] an annular ring
b] entire z plane except z=0
c] entire z plane except z=∞

5) If the sequence is real and even then the DFT consists of

a] real and even parts


b] purely imaginary parts

5. Conduction of Viva-Voce Examinations:


Questions to be prepared for viva voce examinations

1. Define Discrete time Signal


2. State the advantages of Digital Signal Processing.
3. What do you mean by aliasing? How to overcome?
4. Define LTI system
5. What is the significance of convoution.
6. State the applications of autocorrelation and cross correlation
7. Compare IIR with FIR filters
8.What are linear phase filters ?
9. List different applications of DSP.
10.Explain architectural overview of TMS 3205402 DSK.

6. Evaluation and marking system:


As per JNEC format/University marking scheme.

You might also like