|
From: | Dominique Richard |
Subject: | alternative to fmins |
Date: | Mon, 18 Jan 2016 11:25:33 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
Hello everyboby, I am using fmins to estimate a set of parameters by minimizing the error between modelized curves and experimental data. But I am afraid of not getting the best result and possibly falling into secondary minima. Is there a way to avoid this pitfall. More generally are they other functions that I could use instead ot 'fmins' for parameter estimation ? Schematically my programs consist in 3 scripts: - main.m for input of data, call of minimization function, output of result - CSSE.m for computing the errors betwen modelized and experiemental points (the only one fully detailed here) - model.m for calculating the model points and they look like this : main.m p0 = [p01; p02; p03]; reading experimental data and experimental conditions for each experiment p = fmins("CSSE", p0, [1;tol;0;0;0;1],[], X, Ydata, Zall, exp, spt) % where % X is time % Ydata are the experimental points % Zall are the experimental conditions, defined for each experiment % exp are the reference of the experiments % spt is the total number of points saving the results plotting the experimental and modelized (with the optimized set ot parameters) curves plotting the parity curves
CSSE.m function collected_sum = CSSE_final(p,x,y,Zall,exp,spt) collected_sum = 0; nexp = size(exp,1);
for i = 1:nexp Zrun = Zall((9*(i-1)+1):(9*i),1); % experimental conditions for run #i Xrun = x(spt(i,1):(spt(i+1,1)-1),1); % time vector for run #i Yrun = y(spt(i,1):(spt(i+1,1)-1),1); % experimental Cb vector for run #i %Computation of y with the trial parameters. [Cb_trial] = model(Xrun,p,Zrun); % y_trial = Cb_trial'; difference = Yrun - y_trial; % Difference between estimated and experimental data sum_square_errors = sum(difference.^2); % The sum of the squared errors collected_sum = collected_sum + sum_square_errors; endfor endfunction
model.m function [Cb] = model(X,p,Z) calculation of Cb over the time range as a function ot the parameters (p) and the experimental conditions (Z) endfunction Thank you for your help. |
[Prev in Thread] | Current Thread | [Next in Thread] |