DSP EXP. 5 Solution
DSP EXP. 5 Solution
DSP EXP. 5 Solution
1- Objectives:
The corresponding input and output signals are shown in Figure (a) and (b),
respectively. Our output signal has the same values as the original signal but spans
from n = -5 to n = 1 instead of n = -3 to n = 3. The signal shown in Figure (b) is
aptly referred to as a time-advanced signal
Program:
clc
close all;
n=0:1:8;
m=[0,0,1,2,3,4,5,4,3];
subplot(2,1,1);
stem(n,m);
axis([-10 15 -7 7])
grid on
subplot(2,1,2)
stem(-n,m)
axis([-10 15 -7 7])
grid on
subplot(3,1,1);
stem(n,amp);
axis([-10 15 -2 2])
grid on
subplot(3,1,2)
stem(n*2,amp)
axis([-10 15 -2 2])
grid on
subplot(3,1,3)
stem(n*0.5,amp)
axis([-10 15 -2 2])
grid on
4) For the following continuous- time signal y=sin (2 pi t), write a program in
MATLAB simulation to find the time shifting where, k=+2 and k=-2 for t=0 to
4?
Program:
clc
close all;
n=0:4*pi;
amp=sin(n);
x1=n+2;
x2=n-2;
subplot(3,1,1);
stem(n,amp);
axis([-10 15 -2 2])
grid on
subplot(3,1,2)
stem(x1,amp)
axis([-10 15 -2 2])
grid on
subplot(3,1,3)
stem(x2,amp)
axis([-10 15 -2 2])
grid on
4- Discussion
subplot(2,1,2)
stem(t,y);
axis([-10 15 -7 7])
grid on
2) Multiply signal X with signal Y given that; X= [5 1 0 6] and Y= [-1 0 0.5 3] ?
Program:
clc
close all;
clear all;
t=0:3;
x= [5 1 0 6];
y= [-1 0 0.5 3] ;
multi=x.*y;
disp(multi);
subplot(3,1,1)
stem(t,x);
axis([-10 15 -7 7])
grid on
subplot(3,1,2)
stem(t,y);
axis([-10 15 -7 7])
grid on
subplot(3,1,3)
stem(t,multi);
axis([-10 15 -7 7])
grid on
subplot(3,1,2)
stem(t,xmulti);
axis([-10 15 -7 7])
grid on
subplot(3,1,3)
stem(t,xdiv);
axis([-10 15 -7 7])
grid on