0

Say I have performed FFT on a set of data and i have the frequency and amplitude values. I want to find the highest amplitude in each FFT block. The I need to find the frequency and amplitude of the points that are atleast greater than 0.4 times the max amplitude and save them in an array.. How can i do this?? I tried the following method by I keep getting an empty matrix....

% the code after FFT
peak_points = [];

    fmin = 60;
    fmax = 1000;
    region_of_interest = fmax>f & f>fmin;
    froi = f(region_of_interest);

    [p_max,loc] = max(seg_fft2(region_of_interest));

    p_max;
    fpeaks = froi(loc);

    [points, locatn] = findpeaks(seg_fft2(region_of_interest));

    if points > 0.4*p_max
        peak_points = [peak_points ; points locatn]
    end

Im bad with arrays.. So I cant seem to figure this out. Would appreciate someone's help in this... Thanks in advance...

1 Answer 1

1

Are you intending to do the seg_ffr2 on the region of interest logical array or on froi?

or maybe points is vector and you should have:

aboveMax = points > 0.4*p_max;
if any(aboveMax)   
        peak_points = [peak_points ; points(aboveMax) locatn(aboveMax)]
end
Sign up to request clarification or add additional context in comments.

2 Comments

Well I need to only consider the region between 60 Hz and 100 Hz and find the max in that region. The line region_of_interest = fmax>f & f>fmin; defines that region, so seg_fft2 is done on that...
Thank you. It works fine in detecting the correct amplitudes. However locatn(aboveMax) doesn't give me the frequency of the point. What can I do to get the frequency value??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.