How to find the X-coordinate of the plot knowing the Y-value?

16 ビュー (過去 30 日間)
Aditya Ramnarayan
Aditya Ramnarayan 2019 年 6 月 27 日
コメント済み: Aditya Ramnarayan 2019 年 6 月 27 日
I am carrying out the Fast Fourier Transform for a time series of data. I have found out the maximum value of the voltage amplitude. However, I want to find out at what frequency value do we get the maximum voltage amplitude. How do I get that? In this case the maximum voltage amplitude turns out to be 474.0488.
clc;
clear all;
close all;
a=load('12.0.txt');
e=abs(a(:,2));
N=length(e);
e_m = sum(e)/N;
E=e-e_m;
dftE=fft(E,N);
dftE=dftE(1:N);
max0=abs(dftE);
f=0.1:0.1:5000;
plot(f,max0)
xlabel('Frequency');
ylabel('Voltage Amplitude');
legend('FFT of a Voltage Signal');
axis([0 100 0 500])
grid on
b = max(max0)
fftplot.jpg
  1 件のコメント
Adam
Adam 2019 年 6 月 27 日
doc max
shows that max has a second output, which is the index at which the maximum value occurs. Use this as an index into your frequency vector and that will give you the answer.

サインインしてコメントする。

採用された回答

Torsten
Torsten 2019 年 6 月 27 日
[~,index] = max(max0);
frequency_value = f(index)

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by