做到项目有需要压力采集的处理,为了便于在程序中计算采集的波形数据,这里简单写一个查找波峰的程序
首先用Python把波峰点找出来,
方便我们对照
我这里主要是判断波峰,波谷的原理也大同小异,改一下程序就行
波峰判断条件就是:前一段上升,后一段下降,并且本身是这段点的最大值(波谷就找最小值)
判断是否是上升段(从左往右看),
其中top_width是判断的取样长度,judg_rate相当于是一个阈值,因为波形并不是完全理想的
cpp
int is_rise(float *ydata,int index,int size,int *max,int *min){//左侧上升
int tempi=0,sum=0,judg_len,start_index;
*max=index;
*min=index;
judg_len = (index <= top_width ? index==0 ? 0 : index : top_width-1);
start_index = (index <= top_width )? 0 : index-top_width;
// printf("len %d start %d\n",judg_len,start_index);
for(tempi = start_index ; tempi< (judg_len+start_index);tempi++ ){
if(judg_len<=0) break;
// printf("index %d max %d min %d\n",tempi,*max,*min);
if(ydata[tempi] < ydata[tempi+1] ) sum++;
if(ydata[tempi] > ydata[tempi+1] ) sum--;
if(ydata[*max]<ydata[tempi]) *max = tempi;
if(ydata[*min]>ydata[tempi]) *min = tempi;
if(ydata[*max]<ydata[tempi+1]) *max = tempi+1;
if(ydata[*min]>ydata[tempi+1]) *min = tempi+1;
}
if(sum>judg_len*judg_rate&&judg_len>0) return 1;
if(sum<judg_len*judg_rate&&judg_len>0) return -1;
return 0;
}
然后是判断下降段(从左往右),
原理和判断上升差不多
cpp
int is_drop(float *ydata,int index,int size,int *max,int *min){//右侧下降
int tempi=0,sum=0,judg_len,start_index;
*max=index;
*min=index;
judg_len = (index >= size-1-top_width ? size-index-2 : top_width-1);
start_index = index;
// printf("len %d start %d\n",judg_len,start_index);
for(tempi = index; tempi< judg_len+start_index;tempi++ ){
if(judg_len<=0) break;
// printf("index %d max %d min %d\n",tempi,*max,*min);
if(ydata[tempi] > ydata[tempi+1] ) sum++;
if(ydata[tempi] < ydata[tempi+1] ) sum--;
if(ydata[*max]<ydata[tempi]) *max = tempi;
if(ydata[*min]>ydata[tempi]) *min = tempi;
if(ydata[*max]<ydata[tempi+1]) *max = tempi+1;
if(ydata[*min]>ydata[tempi+1]) *min = tempi+1;
}
if(sum>judg_len*judg_rate&&judg_len>0) return 1;
if(sum<judg_len*judg_rate&&judg_len>0) return -1;
return 0;
}
然后是判断是否是波峰,
依据就是前段上升,后段下降,并且是最大值
cpp
int is_top(float *ydata,int index,int size){
int max_d,min_d,max_r,min_r;
if(is_drop(ydata,index,size,&max_d,&min_d)==1&&is_rise(ydata,index,size,&max_r,&min_r)==1&&max_d==max_r) {
return 1;
}
return 0;
}
如果要找一系列波峰点
,就直接添加到数组中,使用realloc扩展内存空间
cpp
int find_wave_top(float *ydata, int size,int *top_array){
int top_array_size=0;
for(temp_i[1]=0;temp_i[1]<size;temp_i[1]++){
if(is_top(ydata,temp_i[1],size)/*&&(top_array_size>0 ? ydata[top_array[top_array_size-1]]!= ydata[temp_i[1]]: 1)*/){//是一个波峰 ,并且不是和上一个的值相同。即只取第一个值
top_array = (int *) realloc(top_array, (top_array_size+1)*sizeof(int));
top_array_size++;
top_array[top_array_size-1] = temp_i[1];
}
}
return top_array_size;
}
在最后主函数调用
cpp
int main(){
int *top_array = (int *) malloc(sizeof(int)),array_len,min,max,isris;
data_len = sizeof(ydata)/sizeof(float);
// printf("y size %d\n",data_len);
xdata=(float*)malloc(sizeof(float) * data_len);
for(temp_i[0]=0;temp_i[0]<data_len;temp_i[0]++){
xdata[temp_i[0]] = temp_i[0];
}
array_len = find_wave_top(ydata,data_len,top_array);
printf("array len %d\n",array_len);
for(temp_i[0]=0;temp_i[0]<array_len;temp_i[0]++){
printf("index %d value %.1f \n",top_array[temp_i[0]],ydata[top_array[temp_i[0]]]);
}
return 0;
}
如果不取消注释,就会找到相同值的波峰点,和Python对比可以发现,Python的是取中间的值作为波峰,我这里如果取消注释,则只取第一个作为波峰,如果需要中间的可以自行更改
取消注释后,消除重复值的效果
最后是一些变量的创建,以及测试数据
cpp
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "math.h"
float ydata[]={103.422157,103.003632,103.003632,103.003632,103.003632,103.003632,102.609558,102.609558,102.609558,102.609558,102.609558,102.609558,102.609558,102.237953,102.237953,102.237953,102.237953,102.237953,101.886101,101.886101,101.886101,101.886101,101.886101,101.886101,101.886101,101.886101,101.552979,101.552979,101.552979,101.552979,101.552979,101.241447,101.241447,101.241447,101.241447,101.241447,101.241447,101.241447,100.947762,100.947762,100.947762,100.947762,100.947762,100.669060,100.669060,100.669060,100.669060,100.669060,100.669060,100.669060,100.669060,100.404457,100.404457,100.404457,100.404457,100.404457,100.404457,100.404457,100.150131,100.150131,100.150131,100.150131,100.150131,99.901215,99.901215,99.901215,99.901215,99.901215,99.901215,99.901215,99.901215,99.651100,99.651100,99.651100,99.651100,99.651100,99.395378,99.395378,99.395378,99.395378,99.395378,99.395378,99.395378,99.139618,99.139618,99.139618,99.139618,99.139618,98.883904,98.883904,98.883904,98.883904,98.883904,98.883904,98.883904,98.883904,98.627251,98.627251,98.627251,98.627251,98.627251,98.372421,98.372421,98.372421,98.372421,98.372421,98.372421,98.372421,98.118561,98.118561,98.118561,98.118561,98.118561,97.861893,97.861893,97.861893,97.861893,97.861893,97.861893,97.861893,97.861893,97.602425,97.602425,97.602425,97.602425,97.602425,97.340103,97.340103,97.340103,97.340103,97.340103,97.340103,97.340103,97.082481,97.082481,97.082481,97.082481,97.082481,96.831429,96.831429,96.831429,96.831429,96.831429,96.831429,96.831429,96.831429,96.582268,96.582268,96.582268,96.582268,96.582268,96.333107,96.333107,96.333107,96.333107,96.333107,96.333107,96.333107,96.084908,96.084908,96.084908,96.084908,96.084908,95.838608,95.838608,95.838608,95.838608,95.838608,95.838608,95.838608,95.838608,95.594170,95.594170,95.594170,95.594170,95.594170,95.352516,95.352516,95.352516,95.352516,95.352516,95.352516,95.352516,95.118378,95.118378,95.118378,95.118378,95.118378,94.886147,94.886147,94.886147,94.886147,94.886147,94.886147,94.886147,94.886147,94.653015,94.653015,94.653015,94.653015,94.653015,94.420784,94.420784,94.420784,94.420784,94.420784,94.420784,94.420784,94.191353,94.191353,94.191353,94.191353,94.191353,93.977951,93.977951,93.977951,93.977951,93.977951,93.977951,93.977951,93.977951,93.795540,93.795540,93.795540,93.795540,93.795540,93.636612,93.636612,93.636612,93.636612,93.636612,93.636612,93.636612,93.502174,93.502174,93.502174,93.502174,93.502174,93.395020,93.395020,93.395020,93.395020,93.395020,93.395020,93.395020,93.395020,93.371483,93.371483,93.371483,93.371483,93.371483,93.517250,93.517250,93.517250,93.517250,93.517250,93.517250,93.517250,93.835945,93.835945,93.835945,93.835945,93.835945,94.326744,94.326744,94.326744,94.326744,94.326744,94.326744,94.326744,94.326744,94.982979,94.982979,94.982979,94.982979,94.982979,95.784981,95.784981,95.784981,95.784981,95.784981,95.784981,95.784981,96.716759,96.716759,96.716759,96.716759,96.716759,97.784782,97.784782,97.784782,97.784782,97.784782,97.784782,97.784782,97.784782,98.983543,98.983543,98.983543,98.983543,98.983543,100.252434,100.252434,100.252434,100.252434,100.252434,100.252434,100.252434,101.426292,101.426292,101.426292,101.426292,101.426292,102.405014,102.405014,102.405014,102.405014,102.405014,102.405014,102.405014,102.405014,103.184731,103.184731,103.184731,103.184731,103.184731,103.768425,103.768425,103.768425,103.768425,103.768425,103.768425,103.768425,104.163452,104.163452,104.163452,104.163452,104.163452,104.374588,104.374588,104.374588,104.374588,104.374588,104.374588,104.374588,104.374588,104.405579,104.405579,104.405579,104.405579,104.405579,104.257309,104.257309,104.257309,104.257309,104.257309,104.257309,104.257309,103.938286,103.938286,103.938286,103.938286,103.938286,103.506615,103.506615,103.506615,103.506615,103.506615,103.506615,103.506615,103.506615,103.072151,103.072151,103.072151,103.072151,103.072151,102.659271,102.659271,102.659271,102.659271,102.659271,102.659271,102.659271,102.271736,102.271736,102.271736,102.271736,102.271736,101.905785,101.905785,101.905785,101.905785,101.905785,101.905785,101.905785,101.905785,101.559525,101.559525,101.559525,101.559525,101.559525,101.235802,101.235802,101.235802,101.235802,101.235802,101.235802,101.235802,100.930870,100.930870,100.930870,100.930870,100.930870,100.640862,100.640862,100.640862,100.640862,100.640862,100.640862,100.640862,100.640862,100.365028,100.365028,100.365028,100.365028,100.365028,100.100418,100.100418,100.100418,100.100418,100.100418,100.100418,100.100418,99.846687,99.846687,99.846687,99.846687,99.846687,99.590912,99.590912,99.590912,99.590912,99.590912,99.590912,99.590912,99.590912,99.331444,99.331444,99.331444,99.331444,99.331444,99.072884,99.072884,99.072884,99.072884,99.072884,99.072884,99.072884,98.814354,98.814354,98.814354,98.814354,98.814354,98.554832,98.554832,98.554832,98.554832,98.554832,98.554832,98.554832,98.554832,98.299118,98.299118,98.299118,98.299118,98.299118,98.045265,98.045265,98.045265,98.045265,98.045265,98.045265,98.045265,97.787643,97.787643,97.787643,97.787643,97.787643,97.787643,97.787643,97.787643,97.525314,97.525314,97.525314,97.525314,97.525314,97.263947,97.263947,97.263947,97.263947,97.263947,97.263947,97.263947,97.008171,97.008171,97.008171,97.008171,97.008171,96.758125,96.758125,96.758125,96.758125,96.758125,96.758125,96.758125,96.758125,96.508972,96.508972,96.508972,96.508972,96.508972,96.260765,96.260765,96.260765,96.260765,96.260765,96.260765,96.260765,96.013466,96.013466,96.013466,96.013466,96.013466,95.768059,95.768059,95.768059,95.768059,95.768059,95.768059,95.768059,95.768059,95.520805,95.520805,95.520805,95.520805,95.520805,95.280113,95.280113,95.280113,95.280113,95.280113,95.280113,95.280113,95.046928,95.046928,95.046928,95.046928,95.046928,94.814705,94.814705,94.814705,94.814705,94.814705,94.814705,94.814705,94.814705,94.583412,94.583412,94.583412,94.583412,94.583412,94.353096,94.353096,94.353096,94.353096,94.353096,94.353096,94.353096,94.121758,94.121758,94.121758,94.121758,94.121758,93.895180,93.895180,93.895180,93.895180,93.895180,93.895180,93.895180,93.895180,93.683632,93.683632,93.683632,93.683632,93.683632,93.496567,93.496567,93.496567,93.496567,93.496567,93.496567,93.496567,93.337639,93.337639,93.337639,93.337639,93.337639,93.204147,93.204147,93.204147,93.204147,93.204147,93.204147,93.204147,93.204147,93.104477,93.104477,93.104477,93.104477,93.104477,93.101646,93.101646,93.101646,93.101646,93.101646,93.101646,93.101646,93.262428,93.262428,93.262428,93.262428,93.262428,93.585838,93.585838,93.585838,93.585838,93.585838,93.585838,93.585838,93.585838,94.075691,94.075691,94.075691,94.075691,94.075691,94.724464,94.724464,94.724464,94.724464,94.724464,94.724464,94.724464,95.513298,95.513298,95.513298,95.513298,95.513298,96.430901,96.430901,96.430901,96.430901,96.430901,96.430901,96.430901,96.430901,97.476448,97.476448,97.476448,97.476448,97.476448,98.644173,98.644173,98.644173,98.644173,98.644173,98.644173,98.644173,99.857948,99.857948,99.857948,99.857948,99.857948,100.961792,100.961792,100.961792,100.961792,100.961792,100.961792,100.961792,100.961792,101.878601,101.878601,101.878601,101.878601,101.878601,102.605804,102.605804,102.605804,102.605804,102.605804,102.605804,102.605804,103.144409,103.144409,103.144409,103.144409,103.144409,103.499115,103.499115,103.499115,103.499115,103.499115,103.499115,103.499115,103.499115,103.680222,103.680222,103.680222,103.680222,103.680222,103.693359,103.693359,103.693359,103.693359,103.693359,103.693359,103.693359,103.535698,103.535698,103.535698,103.535698,103.535698,103.214767,103.214767,103.214767,103.214767,103.214767,103.214767,103.214767,103.214767,102.800056,102.800056,102.800056,102.800056,102.800056,102.389023,102.389023,102.389023,102.389023,102.389023,102.389023,102.389023,101.999634,101.999634,101.999634,101.999634,101.999634,101.635536,101.635536,101.635536,101.635536,101.635536,101.635536,101.635536,101.635536,101.293968,101.293968,101.293968,101.293968,101.293968,100.973991,100.973991,100.973991,100.973991,100.973991,100.973991,100.973991,100.670013,100.670013,100.670013,100.670013,100.670013,100.380966,100.380966,100.380966,100.380966,100.380966,100.380966,100.380966,100.380966,100.106964,100.106964,100.106964,100.106964,100.106964,99.844780,99.844780,99.844780,99.844780,99.844780,99.844780,99.844780,99.592819,99.592819,99.592819,99.592819,99.592819,99.341820,99.341820,99.341820,99.341820,99.341820,99.341820,99.341820,99.341820,99.093552,99.093552,99.093552,99.093552,99.093552,98.845352,98.845352,98.845352,98.845352,98.845352,98.845352,98.845352,98.596191,98.596191,98.596191,98.596191,98.596191,98.348946,98.348946,98.348946,98.348946,98.348946,98.348946,98.348946,98.348946,98.103539,98.103539,98.103539,98.103539,98.103539,97.857185,97.857185,97.857185,97.857185,97.857185,97.857185,97.857185,97.605232,97.605232,97.605232,97.605232,97.605232,97.354172,97.354172,97.354172,97.354172,97.354172,97.354172,97.354172,97.354172,97.105965,97.105965,97.105965,97.105965,97.105965,96.865273,96.865273,96.865273,96.865273,96.865273,96.865273,96.865273,96.623680,96.623680,96.623680,96.623680,96.623680,96.382042,96.382042,96.382042,96.382042,96.382042,96.382042,96.382042,96.382042,96.141342,96.141342,96.141342,96.141342,96.141342,95.903450,95.903450,95.903450,95.903450,95.903450,95.903450,95.903450,95.667458,95.667458,95.667458,95.667458,95.667458,95.433388,95.433388,95.433388,95.433388,95.433388,95.433388,95.433388,95.433388,95.204903,95.204903,95.204903,95.204903,95.204903,95.204903,95.204903,94.978279,94.978279,94.978279,94.978279,94.978279,94.752663,94.752663,94.752663,94.752663,94.752663,94.752663,94.752663,94.752663,94.527931,94.527931,94.527931,94.527931,94.527931,94.305107,94.305107,94.305107,94.305107,94.305107,94.305107,94.305107,94.084152,94.084152,94.084152,94.084152,94.084152,93.863243,93.863243,93.863243,93.863243,93.863243,93.863243,93.863243,93.863243,93.645073,93.645073,93.645073,93.645073,93.645073,93.444847,93.444847,93.444847,93.444847,93.444847,93.444847,93.444847,93.268059,93.268059,93.268059,93.268059,93.268059,93.118568,93.118568,93.118568,93.118568,93.118568,93.118568,93.118568,93.118568,92.996346,92.996346,92.996346,92.996346,92.996346,92.910805,92.910805,92.910805,92.910805,92.910805,92.910805,92.910805,92.934311,92.934311,92.934311,92.934311,92.934311,93.122322,93.122322,93.122322,93.122322,93.122322,93.122322,93.122322,93.122322,93.473022,93.473022,93.473022,93.473022,93.473022,93.988274,93.988274,93.988274,93.988274,93.988274,93.988274,93.988274,94.660522,94.660522,94.660522,94.660522,94.660522,95.467232,95.467232,95.467232,95.467232,95.467232,95.467232,95.467232,95.467232,96.402710,96.402710,96.402710,96.402710,96.402710,97.467033,97.467033,97.467033,97.467033,97.467033,97.467033,97.467033,98.649773,98.649773,98.649773,98.649773,98.649773,99.858902,99.858902,99.858902,99.858902,99.858902,99.858902,99.858902,99.858902,100.937408,100.937408,100.937408,100.937408,100.937408,101.824127,101.824127,101.824127,101.824127,101.824127,101.824127,101.824127,102.523254,102.523254,102.523254,102.523254,102.523254,103.031830,103.031830,103.031830,103.031830,103.031830,103.031830,103.031830,103.031830,103.360245,103.360245,103.360245,103.360245,103.360245,103.516968,103.516968,103.516968,103.516968,103.516968,103.516968,103.516968,103.506615,103.506615,103.506615,103.506615,103.506615,103.326462,103.326462,103.326462,103.326462,103.326462,103.326462,103.326462,103.326462,102.983940,102.983940,102.983940,102.983940,102.983940,102.566368,102.566368,102.566368,102.566368,102.566368,102.566368,102.566368,102.159142,102.159142,102.159142,102.159142,102.159142,101.776306,101.776306,101.776306,101.776306,101.776306,101.776306,101.776306,101.776306,101.417854,101.417854,101.417854,101.417854,101.417854,101.081940,101.081940,101.081940,101.081940,101.081940,101.081940,101.081940,100.764755,100.764755,100.764755,100.764755,100.764755,100.463570,100.463570,100.463570,100.463570,100.463570,100.463570,100.463570,100.463570,100.177315,100.177315,100.177315,100.177315,100.177315,99.904968,99.904968,99.904968,99.904968,99.904968,99.904968,99.904968,99.643593,99.643593,99.643593,99.643593,99.643593,99.386925,99.386925,99.386925,99.386925,99.386925,99.386925,99.386925,99.386925,99.137764,99.137764,99.137764,99.137764,99.137764,98.889565,98.889565,98.889565,98.889565,98.889565,98.889565,98.889565,98.640404,98.640404,98.640404,98.640404,98.640404,98.393105,98.393105,98.393105,98.393105,98.393105,98.393105,98.393105,98.393105,98.146812,98.146812,98.146812,98.146812,98.146812,97.899498,97.899498,97.899498,97.899498,97.899498,97.899498,97.899498,97.648491,97.648491,97.648491,97.648491,97.648491,97.392723,97.392723,97.392723,97.392723,97.392723,97.392723,97.392723,97.392723,97.141716,97.141716,97.141716,97.141716,97.141716,96.899117,96.899117,96.899117,96.899117,96.899117,96.899117,96.899117,96.657532,96.657532,96.657532,96.657532,96.657532,96.413979,96.413979,96.413979,96.413979,96.413979,96.413979,96.413979,96.413979,96.172386,96.172386,96.172386,96.172386,96.172386,95.932594,95.932594,95.932594,95.932594,95.932594,95.932594,95.932594,95.694756,95.694756,95.694756,95.694756,95.694756,95.457817,95.457817,95.457817,95.457817,95.457817,95.457817,95.457817,95.457817,95.227440,95.227440,95.227440,95.227440,95.227440,95.000862,95.000862,95.000862,95.000862,95.000862,95.000862,95.000862,94.775246,94.775246,94.775246,94.775246,94.775246,94.549568,94.549568,94.549568,94.549568,94.549568,94.549568,94.549568,94.549568,94.324844,94.324844,94.324844,94.324844,94.324844,94.102982,94.102982,94.102982,94.102982,94.102982,94.102982,94.102982,93.880157,93.880157,93.880157,93.880157,93.880157,93.659203,93.659203,93.659203,93.659203,93.659203,93.659203,93.659203,93.659203,93.441978,93.441978,93.441978,93.441978,93.441978,93.246468,93.246468,93.246468,93.246468,93.246468,93.246468,93.246468,93.074379,93.074379,93.074379,93.074379,93.074379,93.074379,93.074379,93.074379,92.930534,92.930534,92.930534,92.930534,92.930534,92.813972,92.813972,92.813972,92.813972,92.813972,92.813972,92.813972,92.738731,92.738731,92.738731,92.738731,92.738731,92.786705,92.786705,92.786705,92.786705,92.786705,92.786705,92.786705,92.786705,92.998222,92.998222,92.998222,92.998222,92.998222,93.373390,93.373390,93.373390,93.373390,93.373390,93.373390,93.373390,93.911163,93.911163,93.911163,93.911163,93.911163,94.606003,94.606003,94.606003,94.606003,94.606003,94.606003,94.606003,94.606003,95.433388,95.433388,95.433388,95.433388,95.433388,96.386742,96.386742,96.386742,96.386742,96.386742,96.386742,96.386742,97.467987,97.467987,97.467987,97.467987,97.467987,98.660133,98.660133,98.660133,98.660133,98.660133,98.660133,98.660133,98.660133,99.858902,99.858902,99.858902,99.858902,99.858902,100.907379,100.907379,100.907379,100.907379,100.907379,100.907379,100.907379,101.766907,101.766907,101.766907,101.766907,101.766907,102.438805,102.438805,102.438805,102.438805,102.438805,102.438805,102.438805,102.438805,102.921082,102.921082,102.921082,102.921082,102.921082,103.222321,103.222321,103.222321,103.222321,103.222321,103.222321,103.222321,103.356499,103.356499,103.356499,103.356499,103.356499,103.322716,103.322716,103.322716,103.322716,103.322716,103.322716,103.322716,103.322716,103.119072,103.119072,103.119072,103.119072,103.119072,102.760612,102.760612,102.760612,102.760612,102.760612,102.760612,102.760612,102.343040,102.343040,102.343040,102.343040,102.343040,101.941467,101.941467,101.941467,101.941467,101.941467,101.941467,101.941467,101.941467,101.565170,101.565170,101.565170,101.565170,101.565170,101.213310,101.213310,101.213310,101.213310,101.213310,101.213310,101.213310,100.882996,100.882996,100.882996,100.882996,100.882996,100.572411,100.572411,100.572411,100.572411,100.572411,100.572411,100.572411,100.572411,100.273071,100.273071,100.273071,100.273071,100.273071,99.988640,99.988640,99.988640,99.988640,99.988640,99.988640,99.988640,99.715996,99.715996,99.715996,99.715996,99.715996,99.451767,99.451767,99.451767,99.451767,99.451767,99.451767,99.451767,99.451767,99.196053,99.196053,99.196053,99.196053,99.196053,98.945946,98.945946,98.945946,98.945946,98.945946,98.945946,98.945946,98.694939,98.694939,98.694939,98.694939,98.694939,98.445786,98.445786,98.445786,98.445786,98.445786,98.445786,98.445786,98.445786,98.197578,98.197578,98.197578,98.197578,98.197578,97.948418,97.948418,97.948418,97.948418,97.948418,97.948418,97.948418,97.697365,97.697365,97.697365,97.697365,97.697365,97.443497,97.443497,97.443497,97.443497,97.443497,97.443497,97.443497,97.443497,97.189629,97.189629,97.189629,97.189629,97.189629,96.943344,96.943344,96.943344,96.943344,96.943344,96.943344,96.943344,96.701698,96.701698,96.701698,96.701698,96.701698,96.460991,96.460991,96.460991,96.460991,96.460991,96.460991,96.460991,96.460991,96.221260,96.221260,96.221260,96.221260,96.221260,95.980568,95.980568,95.980568,95.980568,95.980568,95.980568,95.980568,95.740822,95.740822,95.740822,95.740822,95.740822,95.502937,95.502937,95.502937,95.502937,95.502937,95.502937,95.502937,95.502937,95.268852,95.268852,95.268852,95.268852,95.268852,95.041328,95.041328,95.041328,95.041328,95.041328,95.041328,95.041328,94.816597,94.816597,94.816597,94.816597,94.816597,94.591881,94.591881,94.591881,94.591881,94.591881,94.591881,94.591881,94.591881,94.366257,94.366257,94.366257,94.366257,94.366257,94.141541,94.141541,94.141541,94.141541,94.141541,94.141541,94.141541,93.916817,93.916817,93.916817,93.916817,93.916817,93.693993,93.693993,93.693993,93.693993,93.693993,93.693993,93.693993,93.693993,93.471184,93.471184,93.471184,93.471184,93.471184,93.253967,93.253967,93.253967,93.253967,93.253967,93.253967,93.253967,93.063118,93.063118,93.063118,93.063118,93.063118,92.899506,92.899506,92.899506,92.899506,92.899506,92.899506,92.899506,92.899506,92.761314,92.761314,92.761314,92.761314,92.761314,92.649422,92.649422,92.649422,92.649422,92.649422,92.649422,92.649422,92.583611,92.583611,92.583611,92.583611,92.583611,92.657898,92.657898,92.657898,92.657898,92.657898,92.657898,92.657898,92.657898,92.894798,92.894798,92.894798,92.894798,92.894798,93.295349,93.295349,93.295349,93.295349,93.295349,93.295349,93.295349,93.860374,93.860374,93.860374,93.860374,93.860374,94.579659,94.579659,94.579659,94.579659,94.579659,94.579659,94.579659,94.579659,95.425819,95.425819,95.425819,95.425819,95.425819,96.395203,96.395203,96.395203,96.395203,96.395203,96.395203,96.395203,97.492409,97.492409,97.492409,97.492409,97.492409,97.492409,97.492409,97.492409,98.698692,98.698692,98.698692,98.698692,98.698692,99.885246,99.885246,99.885246,99.885246,99.885246,99.885246,99.885246,100.907379,100.907379,100.907379,100.907379,100.907379,101.739731,101.739731,101.739731,101.739731,101.739731,101.739731,101.739731,101.739731,102.380569,102.380569,102.380569,102.380569,102.380569,102.835670,102.835670,102.835670,102.835670,102.835670,102.835670,102.835670,103.113419,103.113419,103.113419,103.113419,103.113419,103.221367,103.221367,103.221367,103.221367,103.221367,103.221367,103.221367,103.221367,103.165047,103.165047,103.165047,103.165047,103.165047,102.937973,102.937973,102.937973,102.937973,102.937973,102.937973,102.937973,102.564522,102.564522,102.564522,102.564522,102.564522,102.147903,102.147903,102.147903,102.147903,102.147903,102.147903,102.147903,102.147903,101.751923,101.751923,101.751923,101.751923,101.751923,101.380318,101.380318,101.380318,101.380318,101.380318,101.380318,101.380318,101.032211,101.032211,101.032211,101.032211,101.032211,100.706581,100.706581,100.706581,100.706581,100.706581,100.706581,100.706581,100.706581,100.397850,100.397850,100.397850,100.397850,100.397850,100.103210,100.103210,100.103210,100.103210,100.103210,100.103210,100.103210,99.819389,99.819389,99.819389,99.819389,99.819389,99.543953,99.543953,99.543953,99.543953,99.543953,99.543953,99.543953,99.543953,99.278770,99.278770,99.278770,99.278770,99.278770,99.024963,99.024963,99.024963,99.024963,99.024963,99.024963,99.024963,98.774849,98.774849,98.774849,98.774849,98.774849,98.525696,98.525696,98.525696,98.525696,98.525696,98.525696,98.525696,98.525696,98.279343,98.279343,98.279343,98.279343,98.279343,98.030190,98.030190,98.030190,98.030190,98.030190,98.030190,98.030190,97.779182,97.779182,97.779182,97.779182,97.779182,97.524361,97.524361,97.524361,97.524361,97.524361,97.524361,97.524361,97.524361,97.270500,97.270500,97.270500,97.270500,97.270500,97.023247,97.023247,97.023247,97.023247,97.023247,97.023247,97.023247,96.780647,96.780647,96.780647,96.780647,96.780647,96.539955,96.539955,96.539955,96.539955,96.539955,96.539955,96.539955};
//float ydata[]={1,2,3,4,5,6,7,8,7,6, 5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3};
float *xdata;
#define top_width 50 //判断波峰的宽度
#define judg_rate 0.1//判断阈值
int data_len,temp_i[10];