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

Bahari Assignment

The document is an assignment for MATLAB code related to Digital Signal Processing (DSP) at Oda Bultum University. It includes tasks to plot specific signals and sequences, as well as MATLAB code examples for generating these plots. The submission date is set for January 6, 2024.

Uploaded by

baharibaahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Bahari Assignment

The document is an assignment for MATLAB code related to Digital Signal Processing (DSP) at Oda Bultum University. It includes tasks to plot specific signals and sequences, as well as MATLAB code examples for generating these plots. The submission date is set for January 6, 2024.

Uploaded by

baharibaahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

ODA BULTUM UNIVERSITY

INSTITUTE OF TECHNOLOGY
DEPARTMENT OF ELECTRICAL AND COMPUTER
ENGINEERING
Title: Assignment for DSP MATLAB Code

Submission Date: 6-Jan-24


Chiro, Oromia, Ethiopia
1 write down the MATLAB code to plot the following signal
a- X1(n)=4u(n)-3u(n-6)-u(n-10)
b- X2(n)=5u(n+2)-25(n)+5u(n-2)
c- X3(n)=(1/π)sin(0.1π n)-(3/π)cos(0.3πn)+(5/π)sin(0.5πn)
2 plot the following sequence & specific the fundamental period
a- X(n)=2cos(2𝜋𝑛/T)-3sin(5πn/8)
b- X(n)=2cos(2πn/7)*3sin(5πn/8)
3 general plot each of the following sequence over the indicated interval.
a- X(n)=2δ(n+2)- δ(n-4) -5≤n≤5
b- X(n)=n[u(n)-u(n-10)]+10e-0.3(n-10) [u(n-10)-u(n-20)] 0≤n≤20
MATLAB CODE

1
a. x1(n)=4u(n)-3u(n-6)-u(n-10)

close all,clc
n1=input('enter lower limit');
n2=input('enter upper limit');
n=[n1:n2];
x1=[4>=0];
x2=[3>=6];
x3=[n>=10];
x=(x1-x2-x3);
stem(n,x)
title('step signal');
xlabel('time value');
ylabel('Amplitude value');
grid on

b. x2(n)=5u(n+2)-25(n)+5u(n-2)
close all,clc
n1=input('enter lower limit');
n2=input('enter upper limit');
n=[n1:n2];
x1=[5>=-2];
x2=[25>=0];
x3=[5>=2];
x=(x1-x2+x3);
plot(n,x)
title('step signal');
xlabel('time value');
ylabel('Amplitude value');
grid on
c. x3(n)=(1/π)sin(0.1π n)-(3/π)cos(0.3πn)+(5/π)sin(0.5πn)

close all,clc
t=0:0.01:1;
f1=0.1/2,f2=0.3/2,f3=0.5/2;
x1=(1/pi).*cos(2*pi*f1*n);
x2=(3/pi).*sin(2*pi*f2*n);
x3=(5/pi).*cos(2*pi*f3*n);
x=x1-x2-x3;
stem(n,x2)
xlabel('time value');
ylabel('Amplitude value');
grid on

3
a. x(n)=2δ(n + 2) − δ(n − 4), −5 ≤ n ≤ 5.
close all,clc
n=[-5:5];
x=2*impseq(-2,-5,5)-impseq(4,-5,5);
stem(n,x);
title('Sequence in a')
xlabel('n');
ylabel('x(n)');
grid on

b. x(n) = n [u(n) − u(n − 10)]+ 10e−0.3(n−10) [u(n − 10) − u(n − 20)], 0 ≤ n ≤ 20.
clear all,close all,clc
n=[0:20];
x1=n.*(stepseq(0,0,20)-stepseq(10,0,20));
x2=10*exp(-0.3*(n-10)).*(stepseq(10,0,20)-stepseq(20,0,20));
x=x1+x2;
subplot(2,2,3);
stem(n,x);
title('Sequence in b')
xlabel('n');
ylabel('x(n)');
grid on

You might also like