0

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.

Vivian Lee
  • 89
  • 1
  • 6
  • 2
    Normally one doesn't decide the sampling frequency. It's set by the ADC you are using at 44.1kHz or so many pixels per picture width. – hotpaw2 Jan 07 '15 at 02:37
  • Can you explain what is ADC,I just make some supplement about my questions above in the"PS" part.Would you mind having a look at it? Thank you! – Vivian Lee Jan 07 '15 at 03:26
  • 2
    ADC --> Analog to Digital Converter. Also, re-iterating what hotpaw said, you normally don't choose the sampling frequency. That is set by the mechanism that converted your analog signal ino its digital equivalent. Normally in academic exercises, given a dimensionless signal, you play around with the sampling frequency to see the effects of the Nyquist sampling theorem. – rayryeng Jan 07 '15 at 05:20
  • 2
    BTW, your title says one thing, but your post says another. Consider modifying the title. Also, this post may help if you want to determine what the frequency is at each point in your FFT: http://stackoverflow.com/questions/4364823/how-to-get-frequency-from-fft-result – rayryeng Jan 07 '15 at 05:24
  • See [this answer](http://stackoverflow.com/a/4371627/253056) for a full explanation. – Paul R Jan 07 '15 at 07:23
  • Since it sounds like you are interested in relative frequencies, just assume a sampling frequency of 1. This will give you frequency values of the FFT that range from -0.5 to +0.5. – AnonSubmitter85 Jan 08 '15 at 17:05

2 Answers2

0

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.

Fateme
  • 21
  • 3
0

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.

Edy
  • 462
  • 3
  • 9