⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 normalize.cpp

📁 一个开源的心电图测量仪驱动和应用软件,可记录
💻 CPP
字号:
// Normalize.cpp: implementation of the Normalize class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ECG_1.h"
#include "Normalize.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Normalize::Normalize()
{

}

Normalize::~Normalize()
{

}
double Normalize::Mean(double *ar0, int lenght)
{
	double MEAN=0;
	for(int i=0;i<lenght;i++)
	{
		MEAN = MEAN + *(ar0+i);
	}
	MEAN = MEAN/lenght;
//	CString str;
//	str.Format("%lf",MEAN);
//	MessageBox(str,"Mean",MB_OK);
	return MEAN;
}

void Normalize::NormalizeArr(double *ar, double mean, int lenght)
{
	double temp = 0;
	for(int i=0;i<lenght;i++)
	{
		if(*(ar+i)>mean)
			temp = *(ar+i)-mean;
		if(*(ar+i)==mean)
			temp = 0;
		if(*(ar+i)<mean)
			temp = *(ar+i)-mean;
		*(ar+i) = temp;
	}
}

void Normalize::SetArrToNormalize(double *dest,int lenght)
{
	NormalizeArr(dest,Mean(dest,lenght),lenght);

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -