Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Course Title: Digital Signal Processing I Lab

Course Code: EEE 314

Lab Report

Experiment No: 04
Experiment Name: Operations on discrete-time signals

Submitted To
Chinmoy Das
Teacher Assistant
Department Of EEE
Bangladesh University of Business & Technology

Remark Submitted By
Name : Mehedi Hasan
Program : B.Sc in EEE (Eve)
Id No : 17181208047
Intake : 22th
Section : 01

Date Of Submission: 15-02-2021


problem 01:

Let x(n) = [1,-2,4,6,-5,8,10]. The sample at n = 0 has been bolded.


Generate and plot the following sequence:
𝒚(𝒏)=𝟑𝒙(𝒏−𝟐)+𝒙(𝒏+𝟒)−𝟐𝒙(𝒏)

close all;
clear all;
clc;
xn=[1 -2 4 6 -5 8 10]
n=-4:2;
k1=-2;
[y1,m1]=sigshift(3*xn,n,k1);

k2=4;
[y2,m2]=sigshift(xn,n,k2);

[y3,m3]=sigshift(2*xn,n,0);
[y4,m4]=sigadd(y1,m1,y2,m2);

[yn,mn]=sigadd(y4,m4,-y3,m3);
stem(mn,yn);
title('y(n)=3x(n+2)+x(n-4)-2x(n)');
xlabel('Time index(n)')
ylabel('Amplitude')

problem 02:
Generate and plot the sequence below over the duration 0 ≤ n ≤ 50:
x(n) = cos(0.1pi*n) (u(n) − u(n − 30))

clear all
close all
clc

n=0:50;
x=cos(0.1*pi*n);
k=0;
[x1,n1]=stepseq(0,50,k);

k=30;
[x2,n2]=stepseq(0,50,k);

[x3,n3]=sigadd(x1,n1,-x2,n2);

[xn,n4]=sigmul(x,n.x3,n3);
stem(n4,xn);
titel('x(n)=cos(0.1*pi*n)*(u(n)-u(n-6))')
xlabel('Time index(n)')
ylabel('Amplitude')

problem 03:
Write a MATLAB function that will decompose a given signal to its even and
odd components.

clear all
close all
clc

x=[10 3 2 1 0 4 4 4 10];
n=-4:4;
subplot(311);
stem(n,x);
titel('Given Signal')
xlabel('Time index(n)')
ylabel('Amplitude')

[xf,nf]=sigfold(x,n);
[xe,ne]=sigadd(0.5,*x,n,0.5*xf,nf);
[xo,no]=sigadd(0.5*x,n,-0.5*xf,nf);

subplot(312);
stem(ne,xe);
title('Even Signal')
xlabel('Time index(n)')
ylabel('Amplitude')
problem 04:
Decompose the signal y(n) in the practice problem 01 into its even and odd
components. Plot the components and the original signal on the same figure.

Clear all;
Close all;
Clc;

xn=[1 -2 4 6 -5 8 10];
n=0:6;
k1=-2;
[y1,m1]=sigshift(3*xn,n,k1);

k2=4;
[y2,m2]=sigshift(xn,n,k2);

[y3,m3]=sigshift(2*xn,n,0);
[y4,m4]=sigadd(y1,m1,y2,m2);

[yn,mn]=sigadd(y4,m4,-y3,m3);
subplote(311)
stem(mn,yn);
title('y(n)=3x(n+2)+x(n-4)-2x(n)');
xlabel('Time index(n)')
ylabel('Amplitude')

[xf,nf]=sigfolf(yn,mn);
[xe,ne]=sigadd(0.5*yn,mn,0.5*xf,nf);
[xo,no]= sigadd(0.5*yn,mn,-0.5*xf,nf);

subplot(312);
stem(ne,xe);
title(‘Even part’)
xlabel(‘Time index (n)’)
ylabel(‘Amplitude’)

subplot(313);
stem(no,xo)
title(‘Odd part’)
xlabel(‘Time index (n)’)
ylabel(‘Amplitude’)
Practice problem 05:
For the signal x(n) = cos (0.1*pi*n) over the duration 0 ≤ n ≤ 10 generate and
plot the following sequence: y(n) = 3x(n − 2) + x(n + 4) – 2x(n)

close all;
clear all;
clc;

n=0:10;
xn==cos(0.1*pi*n);
k1=2;
[y1,m1]=sigshift(3*xn,n,k1);

k2=4;
[y2,m2]=sigshift(xn,n,k2);

[y3,m3]=sigshift(2*xn,n,0);
[y4,m4]=sigadd(y1,m1,y2,m2);

[yn,mn]=sigadd(y4,m4,-y3,m3);
stem(mn,yn);
title('y(n)=3x(n-2)+x(n+4)-2x(n)');
xlabel('Time index(n)')
ylabel('Amplitude')

You might also like