Matlab-从文本文件

时间:2015-05-13 08:05:27

标签: matlab time-frequency

我有一个这样的文本文件:

0.000000,-1.721511E-5,-2.869001E-5
3.906250E-5,-1.859251E-5,-3.247638E-5
7.812500E-5,-2.083079E-5,-2.504133E-5
0.000117,-1.996991E-5,-2.779505E-5
0.000156,-1.866138E-5,-3.044551E-5
0.000195,-2.241480E-5,-2.982592E-5
0.000234,-2.027983E-5,-2.579860E-5
0.000273,-1.786938E-5,-2.497249E-5
0.000312,-1.910904E-5,-2.741642E-5
0.000352,-1.749059E-5,-2.748526E-5
0.000391,-2.141618E-5,-2.855233E-5
0.000430,-2.062418E-5,-2.751968E-5
0.000469,-1.817929E-5,-2.696894E-5
0.000508,-1.511457E-5,-3.030782E-5
0.000547,-1.931565E-5,-2.597071E-5
0.000586,-1.855808E-5,-3.158142E-5
0.000625,-2.072748E-5,-3.054877E-5
0.000664,-2.072748E-5,-3.171910E-5
0.000703,-1.917791E-5,-3.047993E-5
0.000742,-2.289689E-5,-2.486922E-5
0.000781,-2.165723E-5,-2.941286E-5
0.000820,-2.076192E-5,-3.068646E-5
0.000859,-1.776607E-5,-2.583303E-5
0.000898,-1.728398E-5,-2.748526E-5
0.000937,-2.100296E-5,-2.989476E-5
0.000977,-1.728398E-5,-2.865559E-5
0.001016,-2.179497E-5,-3.047993E-5
0.001055,-2.217375E-5,-3.023898E-5
0.001094,-2.048644E-5,-2.531670E-5
0.001133,-1.962556E-5,-2.800158E-5
0.001172,-1.676745E-5,-2.810485E-5
0.001211,-2.155392E-5,-2.782947E-5
0.001250,-1.786938E-5,-2.497249E-5
0.001289,-2.021096E-5,-2.507575E-5
0.001328,-1.549336E-5,-3.075530E-5
0.001367,-2.007322E-5,-2.690009E-5
0.001406,-2.282802E-5,-3.182237E-5
0.001445,-1.979774E-5,-2.572976E-5
...

第一列是时间值,第二列和第三列是第1点和第2点的频率值。我需要获得点1处频率幅度的最大值和第二个最大值,因为可能存在一些不良值然后,我需要在黑匣子中输出范围的值。我该怎么做。 Example 这是我的代码:

y=load('velo_035.txt');
a=y(:,1);
c=y(:,3);
b=y(:,2);
maxb=max(b);
maxc=max(c);
[row,col]=size(a);
rowposimaxb=find(b==maxb);
rowposimaxc=find(c==maxc);
b1=b(rowposimaxb+row/a(row,1):rowposimaxb-row/a(row,1)); %I want to get a range of value before the peak value 1 second, and after the peak value 1 sec
c1=c(rowposimaxc+row/a(row,1):rowposimaxc-row/a(row,1));
subplot(2,1,1);
plot(b1);    
subplot(2,1,2);
plot(c1);

但是,最大值并非总是正确的值,有时它是一个破碎的值。所以我需要频率的第二个最大振幅。 提前谢谢。

0 个答案:

没有答案