![]() |
在MATLAB中计算FFT图下的面积
目前,我对一组数据进行了FFT,从而得到了x轴频率和y轴幅度的图。我想计算图表下的面积,以便给我能量。
我不确定如何确定面积,因为我没有方程式,而且我只想要绘图的某个区域而不是绘图下的整个区域。有办法吗? [B]回答:[/B] 有很多方法可以与Matlab进行数值积分。这是一个例子: %# create some data x = linspace(0,pi/2,100); %# 100 equally spaced points between 0 and pi/2 y = sin(x); %# integrate using trapz, which calculates the area in the trapezoid defined by %# x(k),x(k+1),y(k),y(k+1) for k=1:length(x) integral = trapz(x,y); %# if you only want to integrate part of the data, do partialIntegral = trapz(x(10:20),y(10:20)); %# show the integrated area figure, area(x,y); hold on, area(x(10:20),y(10:20),'FaceColor','red') [url=https://stackoverflow.com/questions/2641809]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 22:48。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.