Label point on FFT plot

조회 수: 5 (최근 30일)
Kcire L
Kcire L 2021년 3월 10일
답변: David K. 2021년 3월 10일
Hi,
I have a plot of an FFT of a signal, I did a findpeak to find the pronounced frequencies, and now I would like to add a label to the peaks.
Does anyone have a quick way of doing that based on my fft_pks, and fft_locs?
Thanks for the help.
[yfft_, freqvec_, yfft_dB_, freq_res] = calcFFT(step4, 'hamming', Fs*100, Fs);
[fft_pks fft_locs] = findpeaks(yfft_, 'MinPeakHeight', 0.4);
semilogx(freqvec_, yfft_)
grid on
xlim([0 2])
hold on
plot(freqvec_(fft_locs(2:3)), fft_pks(2:3), 'rx', "MarkerSize", 8, "linewidth", 2)

채택된 답변

David K.
David K. 2021년 3월 10일
The text function seems to be what you want. After plot use:
text(fft_locs,fft_pks,'your label here');

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by