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

19 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 2-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