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 -
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/24 13:33:14
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 -
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 -
a=[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];
t=a(:,1);
yt=a(:,2);
dt=t(2)-t(1);
lt=length(t);
f0=2*pi/lt;
fy=fft(yt);
for i=1:1:lt
f(i)=f0*(i-1);
P(i)=abs(fy(i))^2;
end
plot(f,P);