How to get dominent frequency from intensity along a curve in an image?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Steven
el 27 de En. de 2014
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 comentarios
Respuesta aceptada
Walter Roberson
el 27 de En. de 2014
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 comentarios
Walter Roberson
el 29 de En. de 2014
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!