The Dft as a Tool in Digital Processing of Discrete

download The Dft as a Tool in Digital Processing of Discrete

of 24

Transcript of The Dft as a Tool in Digital Processing of Discrete

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    1/24

    THE DFT AS A TOOL IN DIGITAL PROCESSING

    OF DISCRETE-TIME SIGNALS BY DISCRETE-

    TIME SYSTEMS

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    2/24

    ABSTRACT

    The Discrete Fourier transform (DFT) is a specific kind ofdiscrete transform,

    used in Fourier analysis. It transforms one function into another, which is called

    the frequency domain representation, or simply the DFT, of the originalfunction. But the DFT requires an input function that is discrete and whose non-

    zero values have a limited duration. Such inputs are often created by sampling a

    continuous function, like a person's voice. Unlike the discrete-time Fourier

    transform (DTFT), it only evaluates enough frequency components to reconstruct

    the finite segment that was analyzed. Using the DFT implies that the finite segment

    that is analyzed is one period of an infinitely extended periodic signal; if this is not

    actually true, a window function has to be used to reduce the artifacts in the

    spectrum. For the same reason, the inverse DFT cannot reproduce the entire time

    domain, unless the input happens to be periodic. Therefore it is often said that the

    DFT is a transform for Fourier analysis of finite-domain discrete-time functions.

    The sinusoidal basis functions of the decomposition have the same properties.

    Discrete Fourier transforms are transforms of finite sequence of complex or real

    numbers. The results are again finite sequence of generally complex numbers.

    Discrete Fourier transforms map a finite sequence of numbers onto a finite

    sequence of numbers. Under the terms discrete Fourier transform we shall

    understand the direct discrete Fourier transform as well as the inverse discreteFourier transform which maps the result of a direct transform back to original

    sequence.

    http://en.wikipedia.org/wiki/Discrete_transformhttp://en.wikipedia.org/wiki/Fourier_analysishttp://en.wikipedia.org/wiki/Function_(mathematics)http://en.wikipedia.org/wiki/Frequency_domainhttp://en.wikipedia.org/wiki/Discrete-time_signalhttp://en.wikipedia.org/wiki/Sampling_(signal_processing)http://en.wikipedia.org/wiki/Discrete-time_Fourier_transformhttp://en.wikipedia.org/wiki/Discrete-time_Fourier_transformhttp://en.wikipedia.org/wiki/Window_functionhttp://en.wikipedia.org/wiki/Window_functionhttp://en.wikipedia.org/wiki/Discrete-time_Fourier_transformhttp://en.wikipedia.org/wiki/Discrete-time_Fourier_transformhttp://en.wikipedia.org/wiki/Sampling_(signal_processing)http://en.wikipedia.org/wiki/Discrete-time_signalhttp://en.wikipedia.org/wiki/Frequency_domainhttp://en.wikipedia.org/wiki/Function_(mathematics)http://en.wikipedia.org/wiki/Fourier_analysishttp://en.wikipedia.org/wiki/Discrete_transform
  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    3/24

    1.INTRODUCTIONThe Discrete Fourier Transform (DFT) plays an important role in the analyses,

    design and implementation of the discrete-time signal- processing algorithms and

    systems. It is used to convert the samples in time domain to frequency domain.

    DFTs is used in wide range of applications in Digital Signal Processing. DFTis identical to samples of the Fourier transform at equally spaced frequencies.

    Consequently, computation of the N-point DFT corresponds to the computation of

    N samples of the Fourier transform at N equally spaced frequencies k= 2k/N.Considering input x[n] to be complex, N complex multiplications and (N-1)

    complex additions are required to compute each value of the DFT, if computed

    directly from the formula given as

    X (k) = , 0 k N-1

    Wn =

    2. THE DISCRETE FOURIER TRANSFORM

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    4/24

    Fourier analysis is a family of mathematical techniques, all based on decomposing

    signals into sinusoids. The discrete Fourier transform (DFT) is the family memberused with digitized signals. The real DFT, a version of the discrete Fourier

    transform that uses real numbers to represent the input and output signals. Thecomplex DFT, a more advanced technique that uses complex numbers.

    Aperiodic-Continuous

    This includes, for example, decaying exponentials and the Gaussian curve. Thesesignals extend to both positive and negative infinity without repeating in a periodic

    pattern. The Fourier Transform for this type of signal is simply called the FourierTransform.

    Periodic-Continuous

    Here the examples include: sine waves, square waves, and any waveform thatrepeats itself in a regular pattern from negative to positive infinity. This version ofthe Fourier transform is called the Fourier Series.

    Aperiodic-Discrete

    These signals are only defined at discrete points between positive and negativeinfinity, and do not repeat themselves in a periodic fashion. This type of Fourier

    transform is called the Discrete Time Fourier Transform.

    Periodic-Discrete

    These are discrete signals that repeat themselves in a periodic fashion from

    negative to positive infinity. This class of Fourier Transform is sometimes called

    the Discrete Fourier Series, but is most often called the Discrete Fourier

    Transform.

    These four classes of signals all extend to positive and negative infinity. A groupof infinitely long signals cannot be used to synthesize something finite in length.The way around this dilemma is to make the finite data look like an infinite length

    signal. This is done by imagining that the signal has an infinite number of sampleson the left and right of the actual points. If all these imaginary samples have a

    value of zero, the signal looks discrete and aperiodic, and the Discrete Time

    Fourier Transform applies. As an alternative, the imaginary samples can be a

    duplication of the actual 1024 points. In this case, the signal looks discrete and

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    5/24

    periodic, with a period of 1024 samples. This calls for the Discrete FourierTransform to be used.

    As it turns out, an infinite number of sinusoids are required to synthesize a signal

    that is aperiodic. This makes it impossible to calculate the Discrete Time FourierTransform in a computer algorithm. By elimination, the only

    type of Fourier transform that can be used in DSP is the DFT. In other words,

    digital computers can only work with information that is discrete and finite inlength. The first three members of the Fourier transform family are generally

    considered while solving mathematical and theoretical issues to ease thecomplexity.

    Each of the four Fourier Transforms can be subdivided into real and complex

    versions. The real version is the simplest, using ordinary numbers and algebra for

    the synthesis and decomposition. The complex versions of the four Fouriertransforms are immensely more complicated, requiring the use of complexnumbers. These are numbers such as: 3 + 4j, where j is equal to -1. Complexmathematics can quickly become overwhelming, even to those that specialize inDSP. The complex Fourier transforms are the realm of those that specialize inDSP, and are willing to sink to their necks in the swamp of mathematics.

    The mathematical term: transform, is extensively used in Digital SignalProcessing, such as: Fourier transform, Laplace transform, Z transform, Hilbert

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    6/24

    transform, Discrete Cosine transform, etc. A transform is an algorithm or

    procedure that changes one value into another value. Transforms allow both theinput and output to have multiple values.

    Transforms are not limited to any specific type or number of data. In short, a

    transform is any fixed procedure that changes one chunk of data into another chunkof data.

    3. PROPERTIES OF DFT

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    7/24

    LINEAR PROPERTY:

    Let x1 (n), x2 (n) are two finite duration sequences, with an equal duration of N

    samples and DFT[ x1 (n) ] = X1 (k), DFT[ x2 (n) ] = X2 (k), then according to linear

    property of DFT, DFT[ a x1 (n) + b x2 (n) ] = a X1 (k) + b X2 (k). Where a & b are

    arbitrary constants.

    PROOF:

    From basic definition of DFT

    DFT[x (n)] =

    Replace x (n) by a x1 (n) + b x2 (n)

    DFT [a x1 (n) + b x2 (n)] = 1(n) + b x2(n)]

    = 1(n) + b x2(n)

    ]

    = 1(n) ] + 2(n)

    ]

    = a 1(n) + b 2(n)

    = a DFT[x1(n)] + b DFT[x2(n)]

    = a X1(k) + b X2(k)

    PERIODIC PROPERTY:

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    8/24

    Let x (n) be a finite duration sequence, with a duration of N samples and DFT[x (n)] = X(

    then according to periodic property of DFT,

    X (N + k) = X (k)

    x (N + n) = x (n)

    PROOF:

    From basic definition of DFT

    DFT[x (n)] =

    Replace k by N + k

    X (N + k) =

    =

    =

    = (1)

    =

    = X (K)

    TIME SHIFTING PROPERTY:

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    9/24

    Let x (n) be a finite duration sequence, with a duration of N samples and DFT[ x(n) ] = X

    then according to time shifting property of DFT, DFT[ x(nn0 ) ] =

    It is also known as circular time shift property.

    PROOF:

    From basic definition of DFT

    DFT[x (n)] =

    Replace k by x (n) by x (nn0)

    DFT[x (n-n0)] =

    Let n-n0=m

    =

    =

    =

    =

    =X (K)

    CIRCULAR CONVOLUTION:

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    10/24

    Circular convolution of a first sequence x 1 (n) having N samples [0 n N1]and a second sequence x 2 (n) having N samples [0 n N1] can be defined as

    X (n) = 1(m)x2(n-m)

    Where

    X (n): Circular convoluted sequence, with duration of N = N1

    N: Duration of x1 (n) or x2 (n) or x (n), 0 n N1

    Durations of circular convoluted sequence x (n), first sequence x 1 (n) and second

    sequences x2 (n) are equal, therefore circular convolution is also known as periodic

    convolution. DFT supports circular convolution, due to equal durations.

    Derivation for Circular Convolution:

    Let x1 (n) and x2 (n) are two finite duration sequences with an equal duration of N

    samples, assume x(n) be the circular convoluted sequence with a duration of N

    samples x(n) = x1 (n) x2 (n), convolution in time domain leads to multiplication

    in frequency domain. i.e. X (k) = X1 (k) X2 (k).

    IDFT of X (k) can be defined as

    IDFT[X (k)] = 1/N

    Replace X (k) = X1 (k) X2 (k)

    IDFT[X (k)] = 1/N 1(k)X2(k)

    x (n) = 1/N 1(k)DFT[x2(k)]

    = 1/N 1(k) ( 2(m)

    ) ]

    Change the order of two sums

    x (n) = 1/N

    2(m) (

    1(k)

    )]

    x (n) = 2(m) ( 1(k)

    )]

    x (n) = 2(m) x1(n-m)] or 1(m) x2(n-m)]

    CIRCULAR CONVOLUTION EXAMPLE:

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    11/24

    Consider the two sequences

    x1(n) ={1, 2, 3, 1}

    x2(n) ={4, 3, 2, 2}

    Each sequence consists of four nonzero points. The sequences x1(n) and x2(n) arerepresented in graph as points on circle.

    X3(m) is obtained by circular convolving x1(n) and x2(n)

    X3(m) = 1(n) x2((m-n))N m =0, 1, 2..N-1

    From the above equation

    For m=0

    X3(0) = 1(n) x2((-n))4

    =4+4+6+3

    =17

    For m=1

    X3(1) = 1(n) x2((1-n))4

    =3+8+6+2

    =19

    For m=2

    X3(2) = 1(n) x2((2-n))4

    =2+6+12+2

    =22

    For m=3

    X3(3) = 1(n) x2((3-n))4

    =2+4+9+4

    =19

    X(m) ={17, 19, 22, 19}

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    12/24

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    13/24

    MATLAB CODE FOR CIRCULAR CONVOLUTION

    clc;clear all;close all;x=input('enter i/p x(n):');m=length(x);h=input('enter i/p sequence h(n)');n=length(h);subplot(2,2,1), stem(x);title('i/p sequencce x(n)is:');xlabel('---->n');ylabel('---->x(n)');grid;subplot(2,2,2), stem(h);title('i/p sequencce h(n)is:');xlabel('---->n');ylabel('---->h(n)');grid;disp('circular convolution of x(n) & h(n) is y(n):');if(m-n~=0)

    if(m>n)h=[h,zeros(1,m-n)];n=m;

    endx=[x,zeros(1,n-m)];m=n;

    endy=zeros(1,n);y(1)=0;a(1)=h(1);for j=2:n

    a(j)=h(n-j+2);endfor i=1:n

    y(1)=y(1)+x(i)*a(i);end

    for k=2:ny(k)=0;for j=2:n

    x2(j)=a(j-1);endx2(1)=a(n);for i=1:n

    if(i

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    14/24

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    15/24

    LINEAR CONVOLUTION

    Convolution is a formal mathematical operation, just as multiplication, addition,and integration. Addition takes two numbers and produces a third number, while

    convolution takes two signals and produces a third signal. Convolution is used in

    the mathematics of many fields, such as probability and statistics. In linear

    systems, convolution is used to describe the relationship between three signals theinput signal, the impulse response, and the output signal.

    y (n) = 1(k)x2(n-k+1) 1

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    16/24

    =1(2) + 2(1)

    =4

    For n=3

    y(3) = 1(k)x2(3-k+1)= x1(1) x2(3-1+1) + x1(2) x2(3-2+1) + x1(3) x2(3-3+1) + x1(4) x2(3-4+1) +

    x1(5) x2(3-5+1) + x1(6) x2(3-6+1)= 0+ x1(2) x2(2) + x1(3) x2(1) + 0+0+0

    = 2(2) + 3(1)=7

    For n=4

    y(4) = 1(k)x2(4-k+1)= x1(1) x2(4-1+1) + x1(2) x2(4-2+1) + x1(3) x2(4-3+1) + x1(4) x2(4-4+1) +x1(5) x2(4-5+1) + x1(6) x2(3-6+1)

    =0 + 0 + x1(3) x2(2) + x1(4) x2(1) +0 +0

    =3(2) + 4(1)=10

    For n=5

    y(5) = 1(k)x2(5-k+1)= x1(1) x2(5-1+1) + x1(2) x2(5-2+1) + x1(3) x2(5-3+1) + x1(4) x2(5-4+1) +

    x1(5) x2(5-5+1) + x1(6) x2(5-6+1)=0 + 0 + 0 + x1(4) x2(2) + x1(5) x2(1) + 0

    =4(2) + 5(1)

    =13

    For n=6

    y(6) = 1(k)x2(6-k+1)= x1(1) x2(6-1+1) + x1(2) x2(6-2+1) + x1(3) x2(6-3+1) + x1(4) x2(6-4+1) +x1(5) x2(6-5+1) + x1(6) x2(6-6+1)

    =0 + 0 + 0 + 0 + x1(5) x2(2) + 0

    =5(2)

    =10

    y(n) = {1, 4, 7, 10, 13, 10}

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    17/24

    MATLAB CODE FOR LINEAR CONVOLUTION

    clc;clear all;close all;disp('linear convolution program');x=input('enter i/p x(n):');m=length(x);

    h=input('enter i/p h(n):');n=length(h);x=[x,zeros(1,n)];subplot(2,2,1), stem(x);title('i/p sequencce x(n)is:');xlabel('---->n');ylabel('---->x(n)');grid;h=[h,zeros(1,m)];subplot(2,2,2), stem(h);title('i/p sequencce h(n)is:');xlabel('---->n');ylabel('---->h(n)');grid;disp('convolution of x(n) & h(n) is y(n):');y=zeros(1,m+n-1);for i=1:m+n-1

    y(i)=0;for j=1:m+n-1

    if(j

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    18/24

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    19/24

    DISCRETE FOURIER TRANSFORM EXAMPLE:

    Consider the sequence

    X (n) = [1, 1, 1, 1, 1, 1, 0, 0]

    The formula for DFT is

    X (k) = k=0: N-1

    From the above sequence we know that N=8

    Calculating DFT of the sequence from the formula

    For k=0

    X (0) = x (0) + x (1) + x (2) + x (3) + x (4) + x (5) + x (6) + x (7)

    =1 +1 +1 +1 +1 +1 +0+0

    X (0) =6

    For k=1

    X (1) = x (0) + x (1) + x (2) + x (3) + x (4) + x

    (5) + x (6) + x (7)

    =1+0.7071-j0.7071+0-j-0.7071-j0.7071-1-0-0.7071+j0.7071+0+0

    X (1) = -0.7071-j1.7071

    For k=2

    X (2) = x (0) + x (1) + x (2) + x (3) + x (4) + x

    (5) + x (6) + x (7)

    =1+0-j-1-0+0+j+1-0+0-j+0+0

    X (2) = 1-j

    For k=3

    X (3) = x (0) + x (1) + x (2) + x (3) + x (4) + x

    (5) + x (6) + x (7)

    = 1-0.7071-j0.7071+0+j+0.7071-j0.7071-1-0+0.7071+j0.7071+0+0

    X (3) = 0.7071+j0.2929

    For k=4

    X (4) = x (0) + x (1) + x (2) + x (3) + x (4) + x

    (5) + x (6) + x (7)

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    20/24

    X (4) = 1-1-0+1-0-1+1-0-1-0+0+0

    X (4) = 0

    For k=5

    X (5) = x (0) + x (1) + x (2) + x (3) + x (4) + x

    (5) + x (6) + x (7)

    = 1-0.7071+j0.7071-0-j+0.7071+j0.7071-1-0+0.7071-j0.7071+0+0

    X (5) = 0.7071-j0.2929

    For k=6

    X (6) = x (0) + x (1) + x (2) + x (3) + x (4) + x

    (5) + x (6) + x (7)

    = 1+0+j-1-0+0-j+1-0+0+j+0+0

    X (6) = 1+j

    For k=7

    X (7) = x (0) + x (1) + x (2) + x (3) + x (4) + x

    (5) + x (6) + x (7)

    = 1+0.7071+j0.7071+0+j-0.7071+j0.7071-1-0-0.7071-j0.7071+0+0

    X (7) = -0.7071+j1.7071

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    21/24

    MATLAB CODE FORDISCRETE FOURIER TRANSFORMclose all;clear all;

    N=input('How many point DFT do you want?');

    x2=input('Enter the sequence=');

    n2=length(x2);

    c= zeros(N);

    x2=[x2 zeros(1,N-n2)];

    for k=1:N

    for n=1:N

    w=exp((-2*pi*i*(k-1)*(n-1))/N);

    x(n)=w;

    end

    c(k,:)=x;

    end

    r=c*x2';

    subplot(211)

    stem(abs(r));

    title('DFT-absolute value');

    subplot(212)

    stem(angle(r));

    title('DFT-angle');

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    22/24

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    23/24

    4. CONCLUSION

    Fourier analysis is a family of mathematical techniques, all based on decomposing

    signals into sinusoids. The discrete Fourier transform (DFT) is the family member

    used with digitized signals. This is the first of four chapters on the real DFT, a

    version of the discrete Fourier transform that uses real numbers to represent the

    input and output signals.

    The time and frequency domains are alternative ways of representing signals. The

    Fourier transform is the mathematical relationship between these two

    representations. If a signal is modified in one domain, it will also be changed in the

    other domain, although usually not in the same way. Mathematical operations,

    such as convolution, addition, scaling and shifting, also have a matching operation

    in the opposite domain. These relationships are called properties of the FourierTransform.

    I have studies the concepts of Discrete Fourier Transform (DFT) and their

    properties. I implemented the discrete Fourier transform equation and their relative

    properties in MATLAB.

  • 7/30/2019 The Dft as a Tool in Digital Processing of Discrete

    24/24

    5. REFERENCES

    The Scientist and Engineer's Guide to Digital Signal Processing

    By Steven W. Smith, Ph.D.

    Discrete Fourier transforms and their applications byek, Vclav.Bristol,

    England ; Boston : Adam Hilger, c1986.

    J G Proakis and D G Manolakis Digital Signal Processing Principles Algorithms

    and Applications 3rd Edition Prentice Hall 1996

    Vinay K. Ingle John G. Proakis, "Digital Signal Processing Using Matlab V.4,

    1997 by PWS PUBLISHING COMPANY

    http://skyline.ucdenver.edu/search~S0?/a%7b233%7dC%7b226%7di%7b233%7dzek%2C+V%7b226%7daclav./acizek+vaclav/-3,-1,0,E/2browsehttp://skyline.ucdenver.edu/search~S0?/a%7b233%7dC%7b226%7di%7b233%7dzek%2C+V%7b226%7daclav./acizek+vaclav/-3,-1,0,E/2browsehttp://skyline.ucdenver.edu/search~S0?/a%7b233%7dC%7b226%7di%7b233%7dzek%2C+V%7b226%7daclav./acizek+vaclav/-3,-1,0,E/2browsehttp://skyline.ucdenver.edu/search~S0?/a%7b233%7dC%7b226%7di%7b233%7dzek%2C+V%7b226%7daclav./acizek+vaclav/-3,-1,0,E/2browse