DSP File
DSP File
a N bil
isr ita
la M t
io
ta
nU
kun
niv
Dr Sha
ersity
Lucknow, Uttar Pradesh
Submitted by Submitted To
2. IMPLEMENTATION OF OPERATIONS ON
SEQUENCES (ADDITION, MULTIPLICATION,
FOLDING)
> Addition of two sequences
> Multiplication of two sequences
> Folding operation on sequence
B.Impulse Signal:
MATLAB SCRIPT
n=-49:49;
delta=[zeros(1,49),1,zeros(1,49)];
C.Ramp Signal:
MATLAB SCRIPT
n=0:10;
r=n;
stem(n,r)
Result :-
D.Exponential Signal:
MATLAB SCRIPT
c=1; alpha=0.8; n=-10:10;
x=c*alpha.^n;
stem(n,x)
Result :-
E. Sin Signal:
MATLAB SCRIPT
n=-18:18;
f=1/12;
stem(n,sin(2*pi*f*n))
Result :-
PROGRAM 2
Result :-
B. Circular convolution of two sequences
MATLAB SCRIPT
clc;clear all;close all;
x=input('Enter x[n]:');
h=input('Enter h[n]:');
xl=length(x);
hl=length(h);
m=max(xl,hl);
z=ifft(fft(x,m).*fft(h,m));
zl=length(z);
%Plots nx=0:xl-1;
nh=0:hl-1;
nz=0:zl-1;
subplot(3,1,1);
stem(nx,x);
xlabel('Time');ylabel('Amplitud')
title('Input sequence x[n]');
subplot(3,1,2);
stem(nh,h);
xlabel('Time');
ylabel('Amplitude
title('Impulse response of the system h[n]');
subplot(3,1,3);
stem(nz,z);
xlabel('Time');
ylabel('Amplitude)
title('Circular Convolution');
Enter x[n]:[2 1 2 1];
h[n]:[1 2 3 4]
Result :-
PROGRAM 5
MATLAB SCRIPT