C语言寻找波峰值

news2024/11/15 22:45:28

做到项目有需要压力采集的处理,为了便于在程序中计算采集的波形数据,这里简单写一个查找波峰的程序

首先用Python把波峰点找出来,

方便我们对照

我这里主要是判断波峰,波谷的原理也大同小异,改一下程序就行

波峰判断条件就是:前一段上升,后一段下降,并且本身是这段点的最大值(波谷就找最小值)

判断是否是上升段(从左往右看),

其中top_width是判断的取样长度,judg_rate相当于是一个阈值,因为波形并不是完全理想的

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

 然后是判断下降段(从左往右),

原理和判断上升差不多

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

然后是判断是否是波峰,

依据就是前段上升,后段下降,并且是最大值

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扩展内存空间

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

在最后主函数调用

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的是取中间的值作为波峰,我这里如果取消注释,则只取第一个作为波峰,如果需要中间的可以自行更改

取消注释后,消除重复值的效果

最后是一些变量的创建,以及测试数据

#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];

完整程序:

opencaneve: 开源STM32HAL ESP8266 ESP32 python Android Windows把我学习到的以及找到的可以用的代码分享出来python记录打卡信息 ESP32蓝牙鼠标 开源windows串口助手 - Gitee.com

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2034370.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

顺丰科技2025届校招面试流程、SHL测评题型、笔试题库及答案解析

顺丰科技有限公司成立于2009年&#xff0c;是顺丰旗下专注供应链数智解决方案的科技服务商。我们深耕于供应链数智化十余年&#xff0c;致力于构建卓越的智慧供应链&#xff0c;重塑全球商业文明和生产方式。我们基于对供应链场景的深度理解和行业头部公司的数智化实战经验&…

手机CPU性能天梯图(2024年8月),含安兔兔/GB6/3DMark跑分

原文地址&#xff08;高清无水印原图/持续更新/含榜单出处链接&#xff09;&#xff1a; 2024年8月手机处理器天梯图 2024年8月1日更新日志&#xff1a;由于近期并未有新处理器发布&#xff0c;故只做常规更新&#xff1b;移除鲁大师天梯图&#xff1b;补充其它天梯图数量。 -…

介质套检测方案,如何提升检测效率?

介质套是一种用于保护和装饰电子设备的外壳或套子。这种套子通常由各种材料制成&#xff0c;如硅胶、塑料、皮革等&#xff0c;具有不同的质地和外观风格。介质套可适用于各种电子设备&#xff0c;如手机、平板电脑、笔记本电脑等&#xff0c;为其提供额外的保护&#xff0c;并…

S32G3系列芯片如何从外置flash进行Boot启动?

《S32G3系列芯片——Boot详解》系列——S32G3系列芯片如何从外置flash进行Boot启动&#xff1f; 一、概述二、基于QuadSPI的boot2.1 基于QuadSPI的boot方式概述2.2 IO配置2.3 时钟配置2.4 QuadSPI具体配置参数2.5 系统重置后BootROM对闪存的要求2.6 应用程序对闪存配置的影响 三…

审稿超慢的顶刊,年年投稿量爆涨?年发文量1800+,国人投稿占优!

点击关注&#xff1a;关注GZH【欧亚科睿学术】&#xff0c;GET完整版2023JCR分区列表&#xff01; &#x1f525; &#x1f525; &#x1f525; &#x1f525; ELSEVIER旗下1区TOP刊 今天小编给大家介绍的是一本计算机人工智能领域的期刊《Engineering Applications of…

腾讯云AI代码助手:智能AI代码助手 ,新一代的高效代码开发辅助工具

前言 近些年是一个科技大爆发的时代&#xff0c;自从大模型发布以来越来越多的科技产品出现。例如去年的智能编码助手自出现以来&#xff0c;各大老牌大厂腾讯&#xff0c;百度 阿里也都紧随其后&#xff0c;智能编码助手的出现可以说大大的节省了我们写一些冗余代码的时间成本…

滑动窗口 | Java | (hot100) 力扣 3

力扣 3.无重复字符的最长子串 暴力法&#xff1a;双层for循环&#xff0c;i-j的字符查重 滑动窗口&#xff1a;因为这题被分在这个类别里&#xff0c;那么已知要用滑动窗口&#xff0c;思路应该是什么。 反正我想不出来…… 看了别人的题解写出来的出错点&#xff1a;特别容易…

达梦数据库的系统视图v$sql_stat

达梦数据库的系统视图v$sql_stat 达梦数据库的系统视图V$SQL_STAT用于记录当前正在执行的SQL语句的资源开销。这个视图需要启用监控功能&#xff08;即ENABLE_MONITOR1&#xff09;才开始监控。针 对 63~68 列 中 的 监 控 项 &#xff0c; 还 需 开 启 参 数 MONITOR_SQL_EXE…

通过这五个问题,带你深入了解中国式报表

一、什么是中国式报表&#xff1f; 中国式报表&#xff0c;顾名思义具有中国特色的报表&#xff0c;通常指的是中国企业/机构在财务和业务报告方面的特有风格和规范。 二、中国式报表有什么特点&#xff1f; 一句话就可以概括中国式报表&#xff1a;结构复杂、数据量大的一种…

计算机毕业设计选题推荐-高校大学生竞赛项目管理系统-Java/Python项目实战

✨作者主页&#xff1a;IT毕设梦工厂✨ 个人简介&#xff1a;曾从事计算机专业培训教学&#xff0c;擅长Java、Python、微信小程序、Golang、安卓Android等项目实战。接项目定制开发、代码讲解、答辩教学、文档编写、降重等。 ☑文末获取源码☑ 精彩专栏推荐⬇⬇⬇ Java项目 Py…

8.13-LVS的nat模式+DR模式

LVS 一、nat模式 1.角色 主机名ip地址功能web01192.168.2.101rsweb02192.168.2.102realserveenat内网:192.168.2.103 外网:192.168.2.120directorserver,ntpdns192.168.2.105dns 2..web服务器 [rootweb01 ~]# yum -y install nginx ​ [rootweb01 ~]# echo "web01&qu…

【netty系列-07】Netty中组件初步了解和基本使用

Netty系列整体栏目 内容链接地址【一】深入理解网络通信基本原理和tcp/ip协议https://zhenghuisheng.blog.csdn.net/article/details/136359640【二】深入理解Socket本质和BIOhttps://zhenghuisheng.blog.csdn.net/article/details/136549478【三】深入理解NIO的基本原理和底层…

Java语言程序设计基础篇_编程练习题*16.20(累计秒表)

目录 题目&#xff1a;*16.20&#xff08;累计秒表&#xff09; 习题思路 代码示例 结果展示 题目&#xff1a;*16.20&#xff08;累计秒表&#xff09; 编写一个程序&#xff0c;模拟一个秒表&#xff0c;如图16-45a所示。当用户单击Start按钮时&#xff0c;按钮的标签变为Pa…

AHB协议解读

1.定义 AHB或者ASB系统总线在需要做大量数据传送的模块之间提供了高带宽的接口。同时&#xff0c;外围总线APB在AHB或者ASB和低带宽的外围设备之间提供了通信的桥梁。所以APB是AHB或者ASB的二级扩展总线 2.拓扑结构 2.1 Master: 可以是CPU、DMA控制器、外设控制器等。Maste…

国内外AI大语言模型推荐分享 除了Chatgpt 你会选择哪个模型?

当前AI技术飞速发展&#xff0c;Ai已经成为许多人日常工作和生活中不可或缺的工具&#xff0c;特别是以大语言模型为首的人工智能&#xff0c;它能够与我们进行自然语言对话&#xff0c;支持多种应用场景&#xff0c;如技术问答、代码生成、内容创作等&#xff0c;而且适用于各…

js入门经典学习小结

简介 js是解释型语言&#xff0c;虽然名字有java&#xff0c;但和java&#xff0c;c等编译型语言不同&#xff0c;它是解释型的&#xff0c;类似perl&#xff0c;py 历史 90年代最早js 1.0版本是网景navigator2引入的 然后欧洲计算机制造商协会&#xff08;ECMA&#xff09…

链上数字供应链高级研修班举办 隆道总裁吴树贵分享供应链数字化实践

8月8日-8月9日&#xff0c;链上数字产业研究院联合中国物流与采购联合会举办的“链上数字供应链高级研修班”在上海开班&#xff0c;隆道公司总裁吴树贵作为培训讲师出席&#xff0c;并系统地分享了供应链理论及数字化转型创新实践经验。 “链上数字供应链高级研修班”旨在贯彻…

TCP详解(一)报文详情/MSS/MTU

本文旨在介绍TCP的报文格式详情和传输层、链路层的字节数限制 1 TCP 协议的报文格式 TCP 报文段包括协议首部和数据两部分&#xff0c;协议首部的固定部分是 20 个字节&#xff0c;头部是固定部分&#xff0c;后面是选项部分。 1.1 端口号 16位源端口&#xff1a;发送方主机…

笔记:在WPF中如何控件级全局事件和应用程序级全局事件

一、目的&#xff1a;在WPF中如何控件级全局事件和应用程序级全局事件 二、实现 应用程序级全局事件 //注册应用程序级全局事件 EventManager.RegisterClassHandler(typeof(Button), Button.ClickEvent, new RoutedEventHandler(ic_event_Click)); 如上代码既会注册全局Butt…

Linux--C语言之循环结构

文章目录 一、循环结构&#xff08;一&#xff09;循环的概念&#xff08;二&#xff09;循环的类型&#xff08;三&#xff09;循环的构成&#xff08;四&#xff09;当型循环的实现while死循环 &#xff08;五&#xff09;for...总结死循环 &#xff08;七&#xff09;循环实…