Article From:https://www.cnblogs.com/profession/p/9969753.html
1、Root mean square (RMS) is sometimes called root mean square (RMS) and validity. It is written in English as: RootMean Square (RMS).The definition of American traditional dictionary is: The square root of the average of squareEs of aset of numbers.
That is, the square sum of N terms divided by N is the result of square root of mean square.#include<iostream>#include "math.h"using namespace std; double calcRMS(double* Data, int Num){    double fSum = 0;    for (int i = 0; i < Num; ++i)    {        fSum += Data[i] * Data[i];    }    return sqrt(fSum/Num);} int main(){    double data[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};    double a = calcRMS(data, 10);    cout << "the rms of data is:" << a << endl;    return 0;}



2、The root mean square error is the square root of the square deviation between the observed value and the true value and the ratio of the observed number n. In practical measurement, the observed number n is always limited, and the true value can only be replaced by the most reliable (best) value. The root square error is very sensitive to a group of very large or very small errors in measurement, so the root mean square error is very sensitive.The difference can well reflect the precision of measurement. The root mean square error (RMS) is defined as the standard deviation, expressed in_, when a quantity is measured many times. _reflects the degree to which the measured data deviate from the true value, and the smaller_is._can be used as a standard to evaluate the accuracy of this measurement process.double calcRMSE(double* Data,double *Data2,int Num){    double fSum = 0;    for (int i = 0; i < Num; ++i)    {        fSum += (Data[i] - Data2[i]) *(Data[i] - Data2[i]);    }    return sqrt(fSum / Num);}int main(){    double dataReal[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};    double dataCheck[10] = { 1.02, 2.1, 2.95, 3.98,5.1, 6.05, 7.1, 7.95, 8.98, 10.1 };    double a = calcRMSE(dataReal,dataCheck,10);    cout << "the rmse of dataREAL and check is:" << a << endl;    return 0;}
3、Standard Deviation is the arithmetic square root of variance, also known as mean square error. It is the average of the distance from the mean of each data. It is the square root after the square and average of the mean difference. It is expressed in_.Precision can reflect the degree of dispersion of a data set.double calcMSR(double* DataR,double *DataC,int Num){    double fSum = 0;    double meanValue = 0;    for (int i = 0; i < Num; ++i)    {        meanValue += DataR[i];    }    meanValue = meanValue / Num;     for (int i = 0; i < Num; ++i)    {        fSum += (DataC[i] - meanValue) *(DataC[i] - meanValue);    }    return sqrt(fSum / Num); //MSR}
--------------------- 

 

Leave a Reply

Your email address will not be published. Required fields are marked *