-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcomputeStats.m
32 lines (30 loc) · 1.01 KB
/
computeStats.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function stats = computeStats(curve, refCurve)
%% computeStats computes statistical parameters of two curves comparison
% This function searches specified curve for peaks in their position.
%
% INPUTS
% curve: approx. curve, double [1 x nS]
% refCurve: reference curve samples, double [1 x nS]
%
% OUTPUTS
% stats: values of curve comparison, struct
% .rmse: root mean square error, double [1 x 1]
% .mae: mean absolue error, double [1 x 1]
% .maxAbs: maximum of absolute error, double [1 x 1]
%
% SYNTAX
%
% stats = computeStats(curveRef, curve)
%
% Function computeStats compares found _curve_ samples with samples of
% a reference curve _refCurve_. The resultin statistical parameters are stored
% in form of struct _stats_.
%
% © 2019, Petr Kadlec, BUT, kadlecp@feec.vutbr.cz
nSamples = size(curve, 2);
difC = curve - refCurve;
difAbs = abs(difC);
stats.rmse = sqrt(1/nSamples*sum(difAbs.^2));
stats.mae = 1/nSamples*sum(difAbs);
stats.maxAbs = max(difAbs);
end