# oversampled Fourier Trasform

Status
Not open for further replies.

#### mfl

##### Newbie level 3 Hello Forum,

given a N-point window h , how do I create an oversampled Fourier transform H out of h ? I need to have very high resolution of the H so that I can find out the magnitude of arbitrary frequency with little frequency error.

This is what I did: to oversample h with factor 2, I first sampled the window h with N * 2 points, and then simply FFT the 'new h' with N*2-point. But the H with N*2 points looks very different from H with N points. What am I doing wrong?

#### FvM

##### Super Moderator
Staff member With "oversampling", you mean duplicating each data point? That will hardly give an advantage, just generates additional noise power. Instead, you would want to interpolate the original sequence when changing the sample rate.

#### mfl

##### Newbie level 3 Hi FvM,

This is my windowing function:

Code dot - [expand]1
2
3
4
5
6
7
8
9
10
11
12
function blackman(N)
# Default alpha = 0.16
a0 = 0.42659;
a1 = 0.49656;
a2 = 0.076849;
w = zeros(N);

for n = 1:N
w[n] = a0 - a1 * cos(2*pi*n/(N-1)) + a2 * cos(4*pi*n/(N-1));
end
return w;
end

I assume an oversampled fft of the window function by a factor of 2 would be fft(blackman(N*2)) (this would be what you meant by interpolating the original sequence, am I right?)

However, the fft values of the original and the oversampled value aren't increasing/decreasing in similar way (I expect the oversampled version to takes twice as much time to increase and decrease, in case the over-sample factor is 2).

Here are some the fft sample values from 1 - 10. the original is FFT(blackman(512)), the oversampled is FFT(blackman(512 * 2))

Code dot - [expand]1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
k = 1
original: 217.9943833003818 + 0.0im
oversampled: 873.2366098911153 + 0.0im
k = 2
original: -127.11893711697411 - 2.340240508514901im
oversampled: -508.4935935475258 - 2.3400747304536136im
k = 3
original: 19.845020222085132 + 0.7309352010595286im
oversampled: 78.87486492124337 + 0.7259756614936985im
k = 4
original: 0.00044320678301414774 + 2.423663020980352e-5im
oversampled: 0.0005516543659794568 + 7.61242746175689e-6im
k = 5
original: 0.007485288714345478 + 0.0005517961643643162im
oversampled: 0.00748836292444639 + 0.00013785416101184825im
k = 6
original: 0.0060558634779024605 + 0.000558513387226844im
oversampled: 0.00605535370050697 + 0.00013934970191932598im
k = 7
original: 0.004581346143077173 + 0.0005075321354533686im
oversampled: 0.004584081103264545 + 0.0001265980340830028im
k = 8
original: 0.0035101418651299794 + 0.0004541979779443242im
oversampled: 0.003516027383715841 + 0.0001132935089731223im
k = 9
original: 0.0027517589243924367 + 0.00040747551324277084im
oversampled: 0.0027600729094881945 + 0.00010164856218561597im
k = 10
original: 0.002205670972923391 + 0.0003679932983093956im
oversampled: 0.0022158009449307643 + 9.181309340287595e-5im

Do I have the wrong idea about oversampling?

Last edited by a moderator:

#### mfl

##### Newbie level 3 OK! My approach was indeed wrong I found out that I need to zero-pad the time domain signal to the desired length L. and then use an FFT of length L.

Thanks for the help!

Hi FvM,

This is my windowing function:

Code dot - [expand]1
2
3
4
5
6
7
8
9
10
11
12
function blackman(N)
# Default alpha = 0.16
a0 = 0.42659;
a1 = 0.49656;
a2 = 0.076849;
w = zeros(N);

for n = 1:N
w[n] = a0 - a1 * cos(2*pi*n/(N-1)) + a2 * cos(4*pi*n/(N-1));
end
return w;
end

I assume an oversampled fft of the window function by a factor of 2 would be fft(blackman(N*2)) (this would be what you meant by interpolating the original sequence, am I right?)

However, the fft values of the original and the oversampled value aren't increasing/decreasing in similar way (I expect the oversampled version to takes twice as much time to increase and decrease, in case the over-sample factor is 2).

Here are some the fft sample values from 1 - 10. the original is FFT(blackman(512)), the oversampled is FFT(blackman(512 * 2))

Code dot - [expand]1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
k = 1
original: 217.9943833003818 + 0.0im
oversampled: 873.2366098911153 + 0.0im
k = 2
original: -127.11893711697411 - 2.340240508514901im
oversampled: -508.4935935475258 - 2.3400747304536136im
k = 3
original: 19.845020222085132 + 0.7309352010595286im
oversampled: 78.87486492124337 + 0.7259756614936985im
k = 4
original: 0.00044320678301414774 + 2.423663020980352e-5im
oversampled: 0.0005516543659794568 + 7.61242746175689e-6im
k = 5
original: 0.007485288714345478 + 0.0005517961643643162im
oversampled: 0.00748836292444639 + 0.00013785416101184825im
k = 6
original: 0.0060558634779024605 + 0.000558513387226844im
oversampled: 0.00605535370050697 + 0.00013934970191932598im
k = 7
original: 0.004581346143077173 + 0.0005075321354533686im
oversampled: 0.004584081103264545 + 0.0001265980340830028im
k = 8
original: 0.0035101418651299794 + 0.0004541979779443242im
oversampled: 0.003516027383715841 + 0.0001132935089731223im
k = 9
original: 0.0027517589243924367 + 0.00040747551324277084im
oversampled: 0.0027600729094881945 + 0.00010164856218561597im
k = 10
original: 0.002205670972923391 + 0.0003679932983093956im
oversampled: 0.0022158009449307643 + 9.181309340287595e-5im

Do I have the wrong idea about oversampling?