matlab如何绘制功率谱0 -5.091020.00024414063 -2.112880.00048828126 -4.865070.00073242189 3.523060.00097656252 -8.167560.00122070315 -4.782390.00146484378 -6.170040.00170898441 -10.57540.00195312504 -2.89020.00219726567 -3.861880.0024414063 -2.5
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/24 13:46:23
matlab如何绘制功率谱0 -5.091020.00024414063 -2.112880.00048828126 -4.865070.00073242189 3.523060.00097656252 -8.167560.00122070315 -4.782390.00146484378 -6.170040.00170898441 -10.57540.00195312504 -2.89020.00219726567 -3.861880.0024414063 -2.5
matlab如何绘制功率谱
0 -5.09102
0.00024414063 -2.11288
0.00048828126 -4.86507
0.00073242189 3.52306
0.00097656252 -8.16756
0.00122070315 -4.78239
0.00146484378 -6.17004
0.00170898441 -10.5754
0.00195312504 -2.8902
0.00219726567 -3.86188
0.0024414063 -2.53418
0.00268554693 -8.04689
0.00292968756 -3.36227
0.00317382819 -0.479067
这是我的数据,前面是时间.
matlab如何绘制功率谱0 -5.091020.00024414063 -2.112880.00048828126 -4.865070.00073242189 3.523060.00097656252 -8.167560.00122070315 -4.782390.00146484378 -6.170040.00170898441 -10.57540.00195312504 -2.89020.00219726567 -3.861880.0024414063 -2.5
t=a(:,1);%%%%t是时间;
yt=a(:,2);%%%%yt是数据;
dt=t(2)-t(1);%%%%dt是点距;
lt=length(t);%%%%是数据的长度;
f0=2*pi/lt;%%%%f0是基频;
fy=fft(yt);%%%%fy是fft变换得到的波谱;
for i=1:1:lt
f(i)=f0*(i-1);%%%%f是频率;
P(i)=abs(fy(i))^2;%%%P是功率谱;
end
plot(f,P); %%%%画图;