matlab 已知函数值纵坐标值(Y值)获得对应的横坐标

时间:2022-06-21 00:00:41
clear all;clc;
x=-pi/2:pi/50:pi;
y=sin(x);
plot(x,y);
grid on;
fm=max(y)
id=find(y==fm);
xm=x(id)
转自:http://zhidao.baidu.com/question/547247688.html
另一种方法:
[~,freq]=max(M);
M为fft变换序列,freq即对应频率点。
一般如果直接做fft的话,freq为对应频率点的位置,需要转换为实际的频率,
具体做法参考matlab中help fft,最后面有个例题,很经典。
转自:http://zhidao.baidu.com/question/50503108.html