Vivian Lee
Vivian Lee

Reputation: 89

How to get the frequency of each point in a DFT or FFT vector?

Suppose H is a vector,and F = fft(H,nfft).

I don't know how to choose an appropriate nfft which is the length of the fft sequence. And how to get the frequncy of each point in the fft sequence? I read an example in

http://www.mathworks.de/help/matlab/math/fast-fourier-transform-fft.html

It says the frequency vector is:

fv = (0:nfft-1)*fs/nfft. 

fs is the sampling frequency. But how to decide the fs?

I would really be grateful if someone could explain me about these questions.

PS:I want to extract features from images.The feature is high order moments defined as follows:

 M = sum (f_ j * |F(f_ j)| ) /sum ( |F(f_ j)| ) , j = 1:L/2

where M is the moments, n is the order of moments, F is the FFT sequence, L is the length of the FFT sequence, F(f_ j) is the component of F at frequency f_ j. But I don't know how to get the frequency f_ j.

*****supplement of my question******

Maybe I didn't explain my question clearly,I read it in a paper "BLIND IMAGE 

STEGANALYSIS BASED ON RUN-LENGTH HISTOGRAM ANALYSIS". The author mentioned the frequency fj in section 2.3 . I'll be very grateful if anybody can read that part.

Upvotes: 0

Views: 580

Answers (2)

Edy
Edy

Reputation: 470

For images, sampling frequency is determined by the resolution (dot-per-cm or dot-per-inch). However, one often do not need to know the sampling frequency because it does not affect the transform results.

For example, a 10-inch by 10-inch picture with 100 dots-per-inch resolution is digitally equivalent to the same picture enlarged to 20-inch by 20-inch but with 50 dots-per-inch resolution. The latter has one-half the sampling frequency as the former, but the difference has no effect on their respective DFT result, as long as the sample values are the same.

Upvotes: 0

Fateme
Fateme

Reputation: 121

I don't know about an image, but i did this for my output which was a waveform :

x=adc_out(3:1:16386);
f=abs(fft(x))/16384;
dbpsd=20*log10(x);
**freq= 256*linspace(0,0.5,16384);** 
plot(freq,dbpsd(1:1:16384/2))

16384 is the number of fft points and 256 is my sampling frequency.

Upvotes: 0

Related Questions