0

I have a text file like this:

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
...

First colum is value of time, Second and 3rd colum is value of frequency at point 1 and 2. I need to get the max and the second max value of amplitude of frequency at point 1, because maybe there are some bad value of amplitude of frequency at point 1. Then, I need to export the value of the range in the black box. How can I do it. Example Here is my code:

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);

However, the max value is not alway right value, sometime it is a broken value. So I need the second max of amplitude of frequency. Thanks in advance.

Community
  • 1
  • 1
  • 3
    and what have you tried so far ? – bla May 13 '15 at 08:07
  • when I using the find(a=max). I just get the max value of amplitude of frequency, and I can get the range of it. However, sometime the max value is a fail data. so, I need the second max value of amplitude of frequency. Please read an update question. Thanks for your time – Vu Ngo Thanh May 13 '15 at 08:37

0 Answers0