0% found this document useful (0 votes)
19 views9 pages

Digital Signal Processing Assignment # 4 THEME: The Discrete Fourier Transform (DFT

Uploaded by

karan kataria
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views9 pages

Digital Signal Processing Assignment # 4 THEME: The Discrete Fourier Transform (DFT

Uploaded by

karan kataria
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Digital Signal Processing

Assignment # 4
THEME: The Discrete Fourier Transform (DFT
Assignment # 4
THEME: The Discrete Fourier Transform (DFT)

Introduction:
This assignment we work on the introduction of the Discrete Fourier Transform (DFT) and points out the
mathematical elements that will be explicated in this book. To find motivation for a detailed study of the DFT,
the reader might first peruse Chapter 8 to get a feeling for some of the many practical applications of the DFT.
Also, In DSP, we can compute the spectrum only at specific discrete values of ω, any signal in any DSP
application can be measured only in a finite number of points. The Discrete Fourier Transform (DFT) is the
equivalent of the continuous Fourier Transform for signals known only at instants separated by sample times.

1. Take a block of length L = 1000 from the sequence,


x(n) = 0.5 n u(n) + d(n)
where, d(n) is uniform random noise lying between [-1,1].
Choose a moving average FIR filter, h(n) of length M = 10.
Obtain the result of linear convolution of x(n) with h(n) using the overlap-add method Use 128-point
DFTs. Deliverables:
1. Block diagram of the process
2. Sample code and simulation results
3. Discussion

Block diagram:
Block diagram of the overlap add method

The code is partitioned into three sections, first the progression succession work given by the educator
is utilized to produce the info arrangement. After that I utilized the capacity to create the channel yield
for the moving normal channel. The capacity is given beneath, and the Moving Average Filter Function
Code is appearing in the reference section.

MATLAB CODE:
function Out = movavgFilt (In, Len, Param)
% The moving average filter operates by averaging a number of points from the
% input signal to produce each point in the output signal. In equation form,
% this is written:
%
% 1 M-1
% Y[i] = --- SUM X[i + j]
% M j=0
Siz = size (In);
Siz_In = Siz (1, 2);

if (isequal (Param, 'Left'))


Pad = zeros (1, Len - 1);
New_In = [Pad In];
for i = 1:Siz_In
temp = 0;
for j = 1:Len
temp = temp + New_In(i + j - 1);
end
Out(i) = temp / Len;
end

elseif (isequal (Param, 'Center'))


len1 = mod (Len, 2);
if isequal (len1, 0)
error ('Cannot use the Len as an even number for this option. Use Left or Right');
else
Pad_Len = (Len - 1)/2;
Pad = zeros (1, Pad_Len);
New_In = [Pad In Pad];
for i = 1:Siz_In
temp = 0;
for j = 1:Len
temp = temp + New_In(i + j - 1);
end
Out(i) = temp / Len;
end
end

elseif (isequal (Param, 'Right'))


Pad = zeros (1, Len - 1);
New_In = [In Pad];
for i = 1:Siz_In
temp = 0;
for j = 1:Len
temp = temp + New_In(i + j - 1);
end
Out(i) = temp / Len;
end

end

Main Code for the Question:


clc

%%%%%%%%%%sequence genration%%%%%%%%
n=0:1:999;
x=(0.5.^n).*stepseq(0,0,999);
%%%%%%%%%%Noise Addition%%%%%%%%%%
awgn=-1 + (1+1)*rand(1,1000);
x1=x+awgn;
%%%%%%%%%% Moving AVG filter
In = x1; % input to the filter
Param = 'Right'; % Movement of the Filter
Len = 10; % Legth of the Filter

Out = movavgFilt (In, Len, Param); % Moving AVG filter called


n_pt=128;
H=fft(Out,n_pt); % FFT of the Filter Response signal
X=fft(x1,n_pt); % FFT of the Input signal

%%%%%%%%% Linear Convolution %%%%%%%%%%%%%%


conv_lin= H.*X;
ov_add= ifft(conv_lin,n_pt);

figure(1);stem(n,x);axis([-1 5 0 1]);title('Input seq');xlabel('sample');ylabel('amplitude');grid on

figure(2);stem(n,x1);title('Input seq with noise');xlabel('sample');ylabel('amplitude');grid on

figure(3);stem(n,Out);title('Input seq with noise after being passed through the filter');xlabel('sample');ylabel('amplitude');grid on

figure(4);stem(X);title('FFT response of Input');xlabel('sample');ylabel('amplitude');grid on

figure(5);stem(H);title('FFT response of Filter output');xlabel('sample');ylabel('amplitude');grid on

figure(6);stem(ov_add);title('IFFT of the Multiplied Signal');xlabel('sample');ylabel('amplitude');grid on

Simulation Result:
It show how all what we anticipated consequences of this task.
Input Sequence

Input Sequence with Noise Added


Output from the Filter

We could have anticipated that the DFT should give a result at only the quantized frequencies either side of the
genuine recurrence. This positively occurs however we likewise track down non-no results at any remaining
frequencies. This spreading impact, which is known as spillage, emerges because we are really computing the
Fourier series for the waveform in Figure4, which has significant discontinuities, subsequently other recurrence
parts.

FFT response of the Input


FFT response of the Filter

Output after multiplying H and X (FFT’s of input and filter response) IFFT is performed after multiplying the
signals.

Discussion:
Above all else, the info signal is created utilizing the "means" work, after that clamor is produced involving the
condition for the stretch [-a, b] "awgn= - b + (b + a) * rand (1, N)". The commotion is then added to the sign to
get the sign that will be separated, a moving normal channel of length M=10 is made the capacity given in the
code. The information signal is sifted by going through the channel. Moreover, to accomplish direct
convolution we need to utilize the accompanying condition.
Both the channel result and clamor added input signal a both took care of into a Fast Fourier change of 128
places, then both the signs are duplicated as in recurrence space to perform convolution we just perform
augmentation of the Fourier changes of the drive reaction and the information signal. To accomplish direct
convolution utilizing cross-over add technique an Inverse Fourier Transform to get the last result of the sign.
The reproduction figures show the different periods of the sign as it advances through various squares it tends
to be seen that the info signal is exceptionally mutilated after the expansion of the commotion and smoothing
impact should be visible after filtration the FFT activity Di spreads the sign to 128 places and after the
convolution is played out the IDFT returns the sign to time-space from the recurrence area.

2. Take the first 100 samples ( 0  n  99 ) of the D-T sequence,


x(n) = 0.25 + 0.95n u(n).
Call that sequence x1 (n).
Create a second sequence x2 (n) = x(2n + 5) of length = 100 as well.
Determine the following:
(a) The N = 128 point DFT of x1 (n) and x2 (n) with a single call to the radix-2 FFT algorithm.
(b) Recover the two sequences from the result in(a).
Deliverables:
1. Block diagram of process
2. Sample code and simulation results
3. Discussion

Block diagram:

Block diagram

MATLAB CODE:
clear; clc

% Generate each 100-point real sequence

n=0:299;

x_par = 0.25 + (0.95.^n);

%x_par = 0.5 + (0.3.^n);

x1 = x_par(1:100);

x2 = x_par(6:2:204);

% Construct the complex sequence

x = x1 + 1j*x2;

%Compute the 128-point DFT of X

N = 128;
X = fft(x,N);

% Find conjugate of modulo-N reversed X

X_flip = fliplr(X(2:N));

X_conj = [conj(X(1)) conj(X_flip)];

% Extract the DFT coefficients of x1 and x2 from X and X conjugate

X1 = 0.5*(X + X_conj);

X2 = (1/2/1j)*(X - X_conj);

% Recover the two sequences from their DFT coefficients

x1_rec = real(ifft(X1));

x2_rec = real(ifft(X2));

% Disply each of the original and recovered sequences

n = 1:100;

figure(1); clf

subplot(211), stem(n,x1,'b*'); hold on; grid on

subplot(211), stem(n,x1_rec(1:100),'r')

xlabel('n'); ylabel('x1(n)'); title('First sequence')

legend('Original', 'Recovered')

subplot(212), stem(n,x2,'b*'); hold on; grid on

subplot(212), stem(n,x2_rec(1:100),'r')

xlabel('n'); ylabel('x2(n)'); title('Second sequence')

legend('Original', 'Recovered')
Simulation Results:

Fig. 2 Unique and recuperated signal covering one another

Discussion:
Both the information signals were created and after for a square length of 100 after that a 128 point FFT was
performed, 128 being the force of 2 making it radix 2 FFT , to recuperate the sign IFFT was performed both the
signs were plotted together and it is apparent from the Fig. 2 that the recuperated signal is same as the
produced succession.

You might also like