how zero padding works?

16 views (last 30 days)
dora
dora on 25 Sep 2014
Edited: Image Analyst on 26 Sep 2014
Hello,
First of all, i would like to inform you that i have a little experience with matlab :( !!!
I want to estimate the spectrum of a part of a signal whick i take of a 1*2624 matrix.i plot it and then with "axis", isolate the part that i want to study.Except for "axis", in which way can i isolate this part? Secondly,i want to zero pad and perform fft to this part of signal and then make its length equal to 1024.
  1 Comment
Image Analyst
Image Analyst on 26 Sep 2014
Edited: Image Analyst on 26 Sep 2014
On Tuesday, Sept. 30, 2014 the Mathworks is giving a free educational webinar on spectral analysis. You might want to sign up. Click here for info on Spectral Analysis webinar.

Sign in to comment.

Answers (1)

Adam
Adam on 25 Sep 2014
Edited: Adam on 25 Sep 2014
A few ideas though I'm sure others can give a fuller more precise answer. I have done a fair bit of work with the fft, but I don't have a background in it so I have only learned it on a "need to know" basis for my work.
The best option is probably to apply a window function to your data in the area of interest. There are lots of different types of window function depending on what you want.
The crudest of course is just a rectangular window, the equivalent of just doing e.g.
signalPart = fullSignal( 200:1000 );
to do the fft on only the part of the signal between samples 200 and 1000.
This is not what I would recommend though because you will get unwanted edge effects and since you do have signal extending beyond your area of interest you can simply taper that signal down to zero with a less aggressive window function.
Something like a hamming window might work decently.
doc hamming
That help page will also guide you towards other window types too in the See Also section.
To apply that you would do something like, for example:
win = hamming( 801 );
signalPart = win .* fullSignal( 200:1000 );
How much of your signal you choose to include is up to you. If you have a lot of signal either side of your region of interest you can make the window bigger than your section of interest so that the tapered part of the signal is outside of it, otherwise you can just window your region of interest and accept that the amplitudes towards the edges will be diminished.
fft will zero pad by default if you choose a number of points greater than the signal length. Usually I take the next power of 2 up from the signal length for the number of fft points unless I have a very short signal section.
  3 Comments
Adam
Adam on 26 Sep 2014
Your original post seemed to suggest you had a 1d signal, but this looks more like 2d
dora
dora on 26 Sep 2014
yes it's 1d signal.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!