How DFT zero padding works

Поділитися
Вставка
  • Опубліковано 2 лис 2024

КОМЕНТАРІ • 29

  • @peerpraia672
    @peerpraia672 8 років тому +1

    I don't know how to thank you enough for this video. Please keep on doing this kind of tutorials, they are the best that exist on the web.

  • @serkanimerkopi384
    @serkanimerkopi384 9 років тому +1

    Thank you! I was looking for an explanation to why zero padding works and you explained it in a great way!

  • @sheikabdulrahman
    @sheikabdulrahman 6 років тому

    Hello David,
    I am trying to understand the FFT, zero padding and windowing functionalities. Unfortunately, I don't have access to Matlab. I found an application note which does the FFT on 8051 uC.
    www.silabs.com/documents/public/application-notes/an142.pdf
    I got samples for sinewave 10Hz signal. When I run FFT for 128 samples the magnitude at 10Hz is 108(for e.g.) and when I zero padded it by another 128 samples the magnitude at 10Hz become 49 but the magnitude around 9Hz and 11Hz got increased to 29 and 31. In your video, you mentioned the magnitude of the signal doesn't change with zero padding but I am seeing a bit variation from that. Any possible explanation for that?
    Please reply.
    Regards
    Sheik

  • @maitripatel137
    @maitripatel137 8 років тому

    Hello Sir , I just wanted to say that all of these videos are v. useful ..I am enjoying this Digital signal processing now..Thank you so much ..:)

  • @jamiestacey3384
    @jamiestacey3384 7 років тому

    Hi Mr Dorran,
    I have been watching your videos and using your code outline for part of my dissertation project and find your work very helpful, so thanks for that. I am currently struggling to effectively zero pad an audio recording and cant understand why. My code reads:
    clc
    clear all
    close all
    [x, fs]=audioread('Front_Right2.m4a');
    % x is the signal, fs is the sample rate
    Ts=1/fs; % sample interval
    N=length(x); % number of samples in the signal
    k=0:N-1;
    t=k*Ts; %time axis
    Seg1=x(1:1323000);
    x_zpad = [Seg1 zeros(1, 100000)]; %zero pad
    X_ZPAD_mags= abs(fft(x_zpad));
    %plot signal
    figure(1)
    subplot(211)
    plot(k,Seg1)
    xlabel('Samples from 0-30 seconds')
    ylabel('amplitude, volts')
    title('Segment One From 0-30 Seconds')
    This is producing an error:
    Error using horzcat
    Dimensions of matrices being concatenated are not consistent.
    Error in Front_Right_windowing (line 15)
    x_zpad = [Seg1 zeros(1, 100000)]; %zero pad
    Could you provide help on why this is not possible?
    Thanks Scott

  • @nazmussalehin7512
    @nazmussalehin7512 8 років тому

    Is it possible to make a music recommender system using these basis functions ? Just comparing with the signal being analyzed ?

  • @eyaleyal9495
    @eyaleyal9495 7 років тому

    Hi David,
    Your videos are very helpful to me to get intuition. Thank you!
    One thing I don't understand is why only non-integer frequency of a sine wave causes the spectrum to spread over few bins. Can't it happen with integer multiples, if the resolution is not high enough ?

    • @ddorran
      @ddorran  7 років тому

      Have you taken a look at ua-cam.com/video/V_dxWuWw8yM/v-deo.html. It might help.

    • @eyaleyal9495
      @eyaleyal9495 7 років тому

      It did help, thanks. I understand now what you meant by integer and non integer.
      There are though couple of questions I would like to ask:
      1. Is the problem really about cutting a signal at a point where its slope is steep ? can we say that windows like Hunning are meant to make the slope at the cutting point close to 0, so the signals energy won't be spread too much (what I remember from a course I have taken is that a infinite signal in time has a finite spread in spectrum, while a finite signal (same as cutting the signal in a steep point) has infinite spread in spectrum) ?
      2. Do I understand correctly - zero padding at the end of a signal just makes more bins / better frequency resolution ?

    • @ddorran
      @ddorran  7 років тому

      1. Yes a sharp "cut" in the time domain does correspond to a broad spread in the frequency domain. An impulse and step signals being an extreme examples of this. The window 'softens' this effect.
      2. Yes (sort of) it does improve DFT frequency bin resolution but not your ability to discriminate between frequency components in the signal. See ua-cam.com/video/eg8eebQPfAo/v-deo.html

  • @shashu1999
    @shashu1999 4 роки тому +1

    excellent video!

  • @rajaduraikanniappan5327
    @rajaduraikanniappan5327 10 років тому

    Hi David.. your videos are life saving . One small doubt, Zero padding by large amount means, how much ?
    Thanks in advance.

    • @ddorran
      @ddorran  10 років тому +2

      For me its zero padding to such an extent that my computer grinds to a halt! In my case this means zero padding so that the length of the signal becomes about 100 million samples.

    • @rajaduraikanniappan5327
      @rajaduraikanniappan5327 10 років тому

      thanks..

  • @bleardloshaj3692
    @bleardloshaj3692 5 років тому

    Such a hero!

  • @andreregis13
    @andreregis13 10 років тому

    Congratulations for your explanation. I've been watching your DFT videos. I would like to ask you, professor. How can I define the length of zero padding? You put the code: x = [x zeros(1,1000)], may I use x = fft(x,L) instead? ( where L =1000) I am new in MATLAB, sorry. Thanks!

    • @ddorran
      @ddorran  10 років тому +1

      with x = [x zeros(1,1000)] you are zero padding by 1000 samples so x is 1000 samples longer that it originally was.
      With x=fft(x,L) if L =1000 the signal will be forced to being 1000 samples before the fft is applied. e.g. if x was 200 samples it would be zero padded by 800 samples before applying the fft. However if x was 1500 samples the last 500 samples of x would be discarded before the fft was applied

    • @andreregis13
      @andreregis13 10 років тому +1

      David Dorran Thanks for your reply, professor, but:
      1- how can I define the length of zero padding?
      2- About your explanation, I understood that is better choose x = [x zeros(1,L)] than x = fft(x,L). Am I right?
      Thanks.

    • @ddorran
      @ddorran  10 років тому +2

      André Luiz Regis Monteiro X = fft(x, length(x) + L); should zero pad by L samples

    • @andreregis13
      @andreregis13 10 років тому

      David Dorran Thank you very much, professor.

  • @andreregis13
    @andreregis13 10 років тому

    Hello professor. It's me again. I would like to ask you about bring back the real magnitude of original signal after applying zero-padding. I am thinking multiply the result as bellow:
    fft(signal_after_zeropadding)*(1/B), where B= length(signal_after_zeropadding)/length(original_signal);
    Is it correct? Thanks a lot!!

    • @ddorran
      @ddorran  10 років тому

      I'm not sure if I understand the question correctly but I think it should be fft(signal_after_zeropadding)/(N/2) where N is the length of the original signal. Try creating a sinusoidal signal and testing it out on that.

    • @andreregis13
      @andreregis13 10 років тому

      David Dorran
      Thank you professor! I will test this and after I will reply you back. Regards.

    • @andreregis13
      @andreregis13 10 років тому

      David Dorran
      Sorry for a long time. It works. Thanks.

    • @pedromuseros4518
      @pedromuseros4518 2 роки тому

      Great video and interesting discussion on the true amplitude, thanks! Regarding the DC component, would one obtain its true amplitude by dividing over N, or over N/2?

  • @jairovideo
    @jairovideo 4 роки тому

    Great video!

  • @fahimjafari1764
    @fahimjafari1764 4 роки тому

    Thank you! it was excellent

  • @fiberkinetics
    @fiberkinetics 10 років тому +3

    also, great accent. more people should talk with irish accents.

  • @ImaginaryHuman072889
    @ImaginaryHuman072889 11 років тому

    excellent video, thanks!