thirdDSP Page 1 of 2
%Name:- Danish Khan
%Roll No.:- EC3151
%Class:- TY A
%Batch:- A3
%Aim:- To write and perform matlab program to Find The Linear Convolution
% Using DFT And IDFT
%Problem Statement:- Given x=[1,2,3,4] h=[1,1,1,1] Then Find The Output Of
% The System. Assume x(n) is Aperiodic.
clc;
clear all;
close all;
%x=input('Enter the first segence');
%h=input('Enter the second sequence') ;
x=[1,2,3,4];
h=[1,1,1,1];
N=length(x)+length(h)-1;
xk= fft(x,N);
hk= fft(h,N);
yk=xk.*hk;
y=ifft(yk,N);
subplot(3,2,1) ;
stem(x);
title('First Segence x(n)');
xlabel('--->Discrete Time');
ylabel('--->Amplitude') ;
subplot(3,2,2);
stem(abs(xk));
title('DFT of first segence');
xlabel('-->Discrete frequency');
ylabel('--->Amplitude');
subplot(3,2,3);
stem(h);
title('Second Sequence h (n) ');
xlabel('--->Discrete Time');
ylabel('--->Amplitude');
subplot(3,2,4);
stem((abs(hk)));
title('DFT of second segence');
xlabel('--->Discrete frequency');
ylabel('--->Amplitude');
subplot(3, 2,5);
stem(abs (y));
title('Linear convolution Output using DFT & IDFT');
xlabel('--->Discrete Time');
ylabel('--->Amplitude');
file:///C:/Danish%20khan%20ec2144/html/thirdDSP.html 26-08-2025
thirdDSP Page 2 of 2
Published with MATLAB® R2013a
file:///C:/Danish%20khan%20ec2144/html/thirdDSP.html 26-08-2025