% startup
if (exist('initDone')==0),
	% add bin folder to Matlab path and initialize RTC Tools
	addpath('./');
	initDone = 1;
end

% initial parameter definition
id = {
'ECORR'
'RFCF'
'TT'
'TTI'
'CFMAX'
'CFR'
'CWH'
'TM'
'BETA'
'CFLUX'
'ETF'
'FC'
'LP'
'ALPHA'
'K'
'K1'
'PERC'
};  
input = [
1.0
1.0
1.0
2.0
3.0
0.8
0.1
1.0
1.2
0.05
0.15
250.0
0.4
0.5
0.04
0.10
3.5];
saveParameters(id, input);

% initialize RTC Tools
RTCToolsMatlab('initialize');
RTCToolsMatlab('DA mode');

[x fval] = fminsearch(@jResCalibration, input)

% close RTC Tools
RTCToolsMatlab('close');