The mini project in Digital signal processing:
Paste this code in MATLAB and press F5
clc
clear all
close all
%%%%%Question# 01%%%%%
A=2+3*exp(j*pi/2)/2+4*7/(3*sqrt(2))
B=cos(pi/2)+7-9*170/2
%%%%%Question# 02(a)%%%%%
n=[-5:5]
x_a=[zeros(1,5) 1 zeros(1,5)]
stem(n,x_a,'filled');
xlabel('n');
ylabel('Amplitude');
title('\delta');
%%%%%Question# 02(b)%%%%%
x_b=[zeros(1,5) ones(1,6)]
figure
stem(n,x_b,'filled');
xlabel('n');
ylabel('Amplitude');
title('u[n]');
%%%%%Question# 02(c)%%%%%
n=[-2:4]
x_1_c=[-1/2 1 2/4 0 1 3 2]
x_2_c=[0 1 4 3 -1 -2 -3]
figure
subplot(2,1,1);
stem(n,x_1_c,'filled')
xlabel('n');
ylabel('Amplitude');
title('x_1');
subplot(2,1,2);
stem(n,x_2_c,'filled');
xlabel('n');
ylabel('Amplitude');
title('x_2');
%%%%%Question# 02(d)%%%%%
n=[-20:20]
f_1=0.15
f_2=0.04
x_1_d=3*cos(2*pi*f_1*n+pi/2)/2
x_2_d=2*cos(2*pi*f_2*n+pi)
figure
subplot(2,1,1);
stem(n,x_1_d,'filled');
xlabel('n');
ylabel('Amplitude');
title('x_1');
subplot(2,1,2);
stem(n,x_2_d,'filled');
xlabel('n');
ylabel('Amplitude');
title('x_2');
%%%%Question# 02(e)%%%%%
n1=[-10:10]
u_n=x_b %%%unit step of part (a)
x_1=(0.5).^n
x_2=(2).^n
x_3=u_n*(0.9).^n
x_4=(-2)*(j*0.9).^n
figure
subplot(2,2,1);
stem(n1,x_1,'filled');
xlabel('n');
ylabel('Amplitude');
title('x_1');
subplot(2,2,2);
stem(n1,x_2,'filled');
xlabel('n');
ylabel('Amplitude');
title('x_2');
subplot(2,2,3);
stem(n1,x_3,'filled');
xlabel('n');
ylabel('Amplitude');
title('x_3');
subplot(2,2,4);
stem(n1,x_4,'filled');
xlabel('n');
ylabel('Amplitude');
title('x_4');
Paste this code in MATLAB and press F5
clc
clear all
close all
%%%%%Question# 01%%%%%
A=2+3*exp(j*pi/2)/2+4*7/(3*sqrt(2))
B=cos(pi/2)+7-9*170/2
%%%%%Question# 02(a)%%%%%
n=[-5:5]
x_a=[zeros(1,5) 1 zeros(1,5)]
stem(n,x_a,'filled');
xlabel('n');
ylabel('Amplitude');
title('\delta');
%%%%%Question# 02(b)%%%%%
x_b=[zeros(1,5) ones(1,6)]
figure
stem(n,x_b,'filled');
xlabel('n');
ylabel('Amplitude');
title('u[n]');
%%%%%Question# 02(c)%%%%%
n=[-2:4]
x_1_c=[-1/2 1 2/4 0 1 3 2]
x_2_c=[0 1 4 3 -1 -2 -3]
figure
subplot(2,1,1);
stem(n,x_1_c,'filled')
xlabel('n');
ylabel('Amplitude');
title('x_1');
subplot(2,1,2);
stem(n,x_2_c,'filled');
xlabel('n');
ylabel('Amplitude');
title('x_2');
%%%%%Question# 02(d)%%%%%
n=[-20:20]
f_1=0.15
f_2=0.04
x_1_d=3*cos(2*pi*f_1*n+pi/2)/2
x_2_d=2*cos(2*pi*f_2*n+pi)
figure
subplot(2,1,1);
stem(n,x_1_d,'filled');
xlabel('n');
ylabel('Amplitude');
title('x_1');
subplot(2,1,2);
stem(n,x_2_d,'filled');
xlabel('n');
ylabel('Amplitude');
title('x_2');
%%%%Question# 02(e)%%%%%
n1=[-10:10]
u_n=x_b %%%unit step of part (a)
x_1=(0.5).^n
x_2=(2).^n
x_3=u_n*(0.9).^n
x_4=(-2)*(j*0.9).^n
figure
subplot(2,2,1);
stem(n1,x_1,'filled');
xlabel('n');
ylabel('Amplitude');
title('x_1');
subplot(2,2,2);
stem(n1,x_2,'filled');
xlabel('n');
ylabel('Amplitude');
title('x_2');
subplot(2,2,3);
stem(n1,x_3,'filled');
xlabel('n');
ylabel('Amplitude');
title('x_3');
subplot(2,2,4);
stem(n1,x_4,'filled');
xlabel('n');
ylabel('Amplitude');
title('x_4');
Categories:
name of the project?????????