summaryrefslogtreecommitdiff
path: root/fitValue.sci
diff options
context:
space:
mode:
Diffstat (limited to 'fitValue.sci')
-rw-r--r--fitValue.sci14
1 files changed, 14 insertions, 0 deletions
diff --git a/fitValue.sci b/fitValue.sci
new file mode 100644
index 0000000..75db2a6
--- /dev/null
+++ b/fitValue.sci
@@ -0,0 +1,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