0% found this document useful (0 votes)
84 views20 pages

DSP Mannual With Matlab

This document contains a practical manual for digital signal processing experiments conducted in the 5th semester of an engineering course. It includes 10 experiments covering topics like matrix manipulation in MATLAB, plotting various signals, implementing the discrete Fourier transform, sampling and quantizing signals, and demonstrating techniques like amplitude, frequency, and phase shifting. Each experiment is described in detail with the code, outputs, and figures.

Uploaded by

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

DSP Mannual With Matlab

This document contains a practical manual for digital signal processing experiments conducted in the 5th semester of an engineering course. It includes 10 experiments covering topics like matrix manipulation in MATLAB, plotting various signals, implementing the discrete Fourier transform, sampling and quantizing signals, and demonstrating techniques like amplitude, frequency, and phase shifting. Each experiment is described in detail with the code, outputs, and figures.

Uploaded by

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

PR AC TIC AL MANNUAL

FOR
Digital signal processing
PEC-552
SESSION 2019-20 SEMESTER-5th

Submitted by: Submitted to:


SHIVAM VATS MR. Akhil Sir
EN (3rd year)
Roll No:22

COLLEGE OF ENGINEERING ROORKEE (ROORKEE)


Index
Name: SHIVAM VATS (EN 3rd. year) Roll No: 14
Sr Page Date of
No. Name of Experiment No. Experiment Remarks
1. Matrix manipulation using MATLAB
2. Sine, Cosine & Ramp signal plotting
3. Implementation of complex exponential
4. Implementation of base DTS
5. To find fast Fourier transform
6. To plot a sampled version of signal
7. To plot a quantized version of signal
8. To demonstrate amplitude shifting
9. To demonstrate frequency shifting
10. To demonstrate phase shifting
EXPERIMENT NO.-1

 MATRIX MANUPULATION USING MATLAB


i. Matrix Declaration

 Declaration of (1*3) matrix


>> a=[1 2 3]

a=

1 2 3

 Declaration of (3*3) matrix


>> b=[1 2 3;4 5 6;7 8 9]

b=

1 2 3
4 5 6
7 8 9
ii.Matrix Addition
>> a=[1 2 3;4 5 6;7 8 9];
>> b=[7 5 6;2 0 8;5 7 1];
>> c=a+b

c=

8 7 9
6 5 14
12 15 10

iii.Matrix Subtraction
>> a=[1 2 3;4 5 6;7 8 9];
>> b=[7 5 6;2 0 8;5 7 1];
>> d=a-b

d=

-6 -3 -3
2 5 -2
2 1 8
iv.Matrix Multiplication
>> a=[1 2 3;4 5 6;7 8 9];
>> b=[7 5 6;2 0 8;5 7 1];
>> e=a*b

e=

26 26 25
68 62 70
110 98 115
EXPERIMENT-2
i. SINE WAVE PLOTTING:
>> t=0:0.1:2*pi;
>> sin(t);
>> plot(t,sin(t))
>> grid on
>> xlabel('t')
>> ylabel('sin(t)')
>> title('sinusoidal signal');
ii. COSINE WAVE PLOTTING
>> t=0:.1:2*pi;
>> a=cos(t);
>> plot(t,a)
>> grid on
>> xlabel('time')
>> ylabel('cos(t)')
>> title('cosine function')
iii. RAMP SIGNAL PLOTTING
>> t=0:.1:100;
>> ramp=t;
>> plot(t,ramp);
>> grid on
>> xlabel('time')
>> ylabel('ramp')
>> title('unit ramp signal');
Experiment-3
IMPLEMENTATION OF COMPLEX EXPONENTIAL
>> t=0:0.1:100;
>> y=exp(j*t);
>> plot3(t,real(y),imag(y));
>> xlabel('time')
>> ylabel('real axis')
>> zlabel('imag axis')
>> grid on
Experiment-4
IMPLEMENTATION OF BASIC DISCRETE TIME
SEQUENCE
i. Unit Step Sequence
>> n=[-5:1:5];
>> y=[zeros(1,5) ones(1,6)]
>> stem(n,y);
>> xlabel('n');
>> ylabel('u[n]');
>> grid on
>> title('unit step sequence');
>> axis([-5 5 -1 2]);
ii. Unit Ramp Sequence
>> n=[0:1:10];
>> stem(n,n);
>> xlabel('n');
>> ylabel('r[n]');
>> title('unit step sequence');
>> grid on
iii. Exponential Sequence
>> a=2;
>> n=[0:1:10];
>> y=a^n;
>> stem(n,y);
>> xlabel('n');
>> ylabel('a^n');
>> title('Exponential sequence');
>> grid on
Experiment-5
TO FIND FAST FOURIER TRANSFORM
>> x=[1,2,3,2,1,4,7];
>> k=[1,2,3,4,5,6,7];
>> disp('fft of given sequence');
>> y=fft(x);
>> y1=abs(y);
>> subplot(2,1,1);
>> stem(y1);
>> title('magnitude vs k');
>> y2=angle(y);
>> subplot(2,1,2);
>> stem(y2);
>> title('phase vs k');
>> y3=ifft(y)
Experiment-6
TO PLOT A SAMPLED VERSION OF SIGNAL
>> fm=1e3;
>> ncycle=2;
>> tm=1/fm;
>> fs1=30e3;
>> ts1=1/fs1;
>>t=(0:ts1:(ncycle*tm));
>>y1=cos(2*pi*fm*t);
>> subplot(2,1,1)
>> stem(y1, 'r')

>> fs2=60e3;
>> ts2=1/fs2;
>>t=(0:ts2:(ncycle*tm));
>> y2=cos(2*pi*fm*t);
>> subplot(2,1,2)
>> stem(y2,'k')
Experiment-7
TO PLOT A QUANTIZED VERSION OF SIGNAL

>> ncycle=2;
>> q=0.25;
>> fm=1e3;
>> tm=1/fm;
>> fs=30e3;
>> ts=1/fs;
>> t=(0:ts:ncycle*tm);
>> y=cos(2*pi*fm*t);
>> r=round(y1/q)*q;
>> plot(y,'k')
>> hold on
>> plot(r,'m','LineWidth',2)
Experiment-8
TO DEMONSTRATE AMPLITUDE SHIFTING
>>fc=20;
>>fm=5;
>>t=0:0.001:1;
>>y=sin(2*pi*fc*t);
>>sq=((square(2*pi*fm*t))+1)/2;
>>z=y.*sq;
>>subplot(3,1,1)
>>plot(t,y,'k')
>>grid on
>>xlabel('time')
>>ylabel('sin(wt)')
>>subplot(3,1,2)
>>plot(t,sq,'r')
>>grid on
>>xlabel('time')
>>ylabel('square')
>>subplot(3,1,3)
>>plot(t,z,'g')
>>grid on
>>xlabel('time')
>>ylabel('ask plot')
Experiment-9
TO DEMONSTRATE FREQUENCY SHIFTING
>> fc1=40;
>> fc2=10;
>>fm=5;
>>t=0:0.001:1;
>>y1=sin(2*pi*fc1*t);
>>y2=sin(2*pi*fc2*t);
>>sq=((square(2*pi*fm*t))+1)/2;
>>for i=0:1000
>>if(sq(i+1)==1)
>>s(i+1)=y1(i+1);
>>else
>>s(i+1)=y2(i+1);
>>end
>>end

>>subplot(4,1,1)
>>plot(t,y1)
>>grid on
>>xlabel('time')
>>ylabel('y1')

>>subplot(4,1,2)
>>plot(t,y2)
>>grid on
>>xlabel('time')
>>ylabel('y2')

>>subplot(4,1,3)
>>plot(t,sq)
>>grid on
>>xlabel('time')
>>ylabel('square')

>>subplot(4,1,4)
>>plot(t,s)
>>grid on
>>xlabel('time')
>>ylabel('fsk')
Experiment-10
TO DEMONSTRATE PHASE SHIFTING
>>fc=20;
>>fm=5;
>>t=0:0.001:1;
>>y=sin(2*pi*fc*t);
>>sq=square(2*pi*fm*t);
>>z=y.*sq;

>>subplot(3,1,1)
>>plot(t,y,'k')
>>gridon
>>xlabel('time')
>>ylabel('y')

>>subplot(3,1,2)
>>plot(t,sq,'r')
>>gridon
>>xlabel('time')
>>ylabel('square')

>>subplot(3,1,3)
>>plot(t,z,'g')
>>gridon
>>xlabel('time')
>>ylabel('psk signal')

You might also like