summaryrefslogtreecommitdiff
path: root/fitValue.sci
blob: 75db2a6f7cea4bd3e7782dbdc16b3df05247cb00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function varargout = fitValue(varargin)
    yData = varargin(1)
    ySys = varargin(2)
    fitValueNum = 0
    fitValueDen = 0
    sampleLength = size(yData,'r')
    yDataMean = mean(yData)
    for ii = 1:sampleLength
        fitValueNum = fitValueNum + (yData(ii)-ySys(ii))^2
        fitValueDen = fitValueDen + (yData(ii)-yDataMean)^2
    end
    fit = 100*(1-sqrt(fitValueNum/fitValueDen))
    varargout(1) = fit
endfunction