0% found this document useful (0 votes)
168 views

Experiment 1: Digital Signal Processing Lab

This document describes experiments conducted using MATLAB to familiarize with basic signal processing concepts. It includes generating and plotting various discrete-time sequences like unit impulse, unit step, ramp, periodic sequences, decaying exponentials, and complex exponentials. It also describes generating random signals that are uniformly distributed and Gaussian distributed. The objectives are met by writing MATLAB code to generate and display the sequences, determining their theoretical periods, and verifying results using MATLAB outputs and functions like stem, subplot, mean, and var. Plots are used to compare signals and comment on observations.

Uploaded by

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

Experiment 1: Digital Signal Processing Lab

This document describes experiments conducted using MATLAB to familiarize with basic signal processing concepts. It includes generating and plotting various discrete-time sequences like unit impulse, unit step, ramp, periodic sequences, decaying exponentials, and complex exponentials. It also describes generating random signals that are uniformly distributed and Gaussian distributed. The objectives are met by writing MATLAB code to generate and display the sequences, determining their theoretical periods, and verifying results using MATLAB outputs and functions like stem, subplot, mean, and var. Plots are used to compare signals and comment on observations.

Uploaded by

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

DIGITAL SIGNAL PROCESSING LAB

Experiment 1
Prepared for: Dr Suresh Rangan
Prepared by: Muhammad Sahid
(B140118EC) 17 July 2017
DIGITAL SIGNAL PROCESSING LAB

FAMILIARISATION EXPERIMENTS (USING MATLAB)

Objective

To familiarise with the basic matlab plots. Formulate equations ,plot graphs for the
questions provided and note down the inferences, results.

QUESTIONS

1. Generate the following discrete time sequences and display using stem function

a. Unit impulse

y=[1,0,0,0,0];

z=[0,1,2,3,4];

stem(z,y)
DIGITAL SIGNAL PROCESSING LAB

b. Unit step

x=-6:1:6; y=[0,0,0,0,0,0,1,1,1,1,1,1,1];
stem(x,y)
c. Unit ramp

x=0:0.01:1;

y=x;

stem(x,y)
d. x{n]={…1,2,3,4,1,2,3,4,….}

function [ ] = periodic( a,n )

b=[];

for i=1:n

b=[b,a];

end

x=1:4*n

stem(x,b)

end
e. x[n]=20(0.9)^(n)u[n]

n=-10:10;

z=zeros(1,21);

z(1,11:21)=1;

x=20*0.9.^n.*z;

stem(n,x)
f. x[n]=0.2(1.2)^(n)u[n]

n=-10:10;

z=zeros(1,21);

z(1,11:21)=1;

x=0.2*1.2.^n.*z;

stem(n,x)
g. x[]n]=(-0.8)^(n)u[n]

n=-10:10;

z=zeros(1,21);

z(1,11:21)=1;

x=(-0.8).^n.*z;

stem(n,x)
i. The complex exponential sequence x[n]=e^(-1/12 +j*pi/6). Display both the real and

imaginary parts.

n=-10:10;

x=exp((-1/12+1i*pi/6).*n);

stem(n,real(x))

hold

stem(n,imag(x))
j. x1[n]=cos(2*pi*n), x2=cos(1.8*pi*n), x3[n]=cos(2.2*pi*n). Compare the plots generated
for the three cases and comment on your result. Plot all the signals in the same figure.
(“subplot” and “hold” function)

n=-10:10;

x1=cos(0.2*pi.*n);

x2=cos(1.8*pi.*n);

x3=cos(2.2*pi.*n);

subplot(3,1,1);

stem(n,x1)

subplot(3,1,2);

stem(n,x2)

subplot(3,1,3);

stem(n,x3)
k. x4[n]=cos(4*pi*n/17), x5[n]=3cos(1.3*pi*n)-4sin(0.5*pi*n+0.5 p), x6[n]=5cos(1.5*pi*n
+0.75p)+4cos(0.6*pi*n) - sin(0.5*pi*n). In each case, determine the period of the of the
sequence theoretically and verify the result using MATLAB output.

n=-20:20;

x4=cos(4*pi/17.*n);

x5=3*cos(1.3*pi.*n)-4*sin(0.5*pi.*n+0.5*pi);

x6=5*cos(1.5*pi.*n+0.75*pi)+4*cos(0.6*pi.*n)-sin(0.5*pi.*n);

subplot(3,1,1);

stem(n,x4)

subplot(3,1,2);

stem(n,x5)

subplot(3,1,3);

stem(n,x6)
l. x(n)=2[n(0.9)n] for n=0:50.

n=0:50;

x=2.*n.*(0.9).^n;

stem(n,x)
m. x[n]=(0.95)n sin(0.1*pi*n) for n=0:50

n=0:50;

x=sin(0.1*pi.*n).*(0.95).^n;

stem(n,x)
2. A random signal of length N with samples uniformly distributed in the interval (0,1) can
be generated by using the MATLAB command x=rand(1,N). Likewise, a random signal
x[n] of length N with samples normally distributed with zero mean and unity variance can
be generated by using the following MATLAB command x=randn(1,N);

Write a MATLAB program to generate and display a random signal of length 100 whose
elements are uniformly distributed in the interval [-2,2] .

N=100;

r = -2+ (2+2)*rand(1,N);

stem(r)

figure

hist(r)
b. Write a MATLAB program to generate and display a Gaussian random signal of length
75 whose elements are normally distributed with zero mean and a variance of 3.(Check
your result with mean() and var()).

N=10000;

a = sqrt(3);

y = a.*randn(N,1);

stats = [mean(y) var(y)]

RESULTS

The basic muthlab plots were plotted and verified

You might also like