|
// 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);
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here