How to get dominent frequency from intensity along a curve in an image?
조회 수: 1 (최근 30일)
이전 댓글 표시
I want to find the dominant frequency. I used fft in this way
yf3 = fftshift(fft2(intensity_profile));
and I got, again for example, this:
First, is it correct? I do not know hot to get the dominant frequency? For now I have plotted the intensity distribution along the circle points. How can I plot it against the frequency?
What I want finally is the main frequency and then wavelength of the profile.
Thanks so much.
Steven
댓글 수: 0
채택된 답변
Walter Roberson
2014년 1월 27일
It appears to be plausible. Your dominant frequency is 0, the DC component.
To get a better idea, you might want to subtract off the mean from the data before fft'ing it.
Note: I would have expected fft() instead of fft2(). Perhaps I am misreading the profile.
댓글 수: 4
Walter Roberson
2014년 1월 29일
cart2pol() converts (x,y) to (theta, r). If you get the ordering wrong, you can sort() the two based upon theta. Then if you diff() the theta you will see that they have not been uniformly sampled. You should be using a Non-Uniform FFT to handle that situation.
But... instead you can cheat some.
Suppose you have the N x 3 array xyv where the first column is x, the second y, the third the associated value. Then
[theta, r] = cart2pol(xyv(:,1), xyv(:,2));
min_theta = min(theta);
max_theta = max(theta);
even_theta = linspace(min(theta), max(theta), length(theta));
[sort_theta, sortidx] = sort(theta);
ordered_v = xyv(sortidx, 3);
even_v = interp1(sort_theta, ordered_v, even_theta);
centered_even_v = evan_v = mean(evan_v);
Now you can
v_fft = fft(centered_even_v);
In this, the (linear) interpolation of (hopefully nearby) points should fudge for the theta not originally being evenly distributed. The subtraction of the mean is to avoid the big spike in the first bin of the fft.
The first output bin would be the DC component, the mean times the number of points -- which should be 0 if you used centered_even_v as the mean was already subtracted off.
The second output bin would be one cycle per period (2*Pi radians), the third output bin would be two cycles per period, the fourth would be three cycles per period, and so on to the centre, the N'th bin being (N-1) cycles per period.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spectral Measurements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!