minimise two functions simultaneously
Mostra commenti meno recenti
Hello,
I have an ODE15s function with 4 simultaneous equations, there are a 7 chemical kinetic rate constants (K) to derive the time changes in four parameters. I am using three of these rate constants to minimise two of the equations simultaneously to two sets of data obtained from the same experiment.
I have tried fminsearch but this only allows the minimisation of one of the functions to one of the data sets based on the difference in the sum of squares error.
I am presently trying fgoalattain to try to get two minimum SSE from two functions against the data but I cannot see how to code it, the goals are presently the SSEs but I need it to change the K values so that the SSEs are minimised. I am also looking at gamultiobj but need to work out how fgoalattain works first and if it will do the job. I have the global optimisation toolbox.
Any help or advice.
Thanks, matt
Risposta accettata
Più risposte (1)
Andrew Newell
il 7 Mar 2011
I'm not sure if I understand your problem, so here is my interpretation. Let's say
eqs = f(t,K)
is your system, where
K = [K0 kvals]
is composed of a 4-vector K0 (fixed) and a 3-vector kval (variable). Let's say that
[t,y] = ode15s(@(t) f(t,K),tspan,y0)
is the way you calculate the output (and tspan is a vector, so t = tspan ). The output y is a matrix with 4 rows, one for each equation. You want to fit, say, equations 1 and 2 to data ydata, so you're trying to minimize a residual sum of squares
res = sum(sum((y(1:2,:)-ydata).^2)).
Then, if you create a function
res = predictData(kvals)
you should be able to apply fminsearch.
EDIT: If you want to use fmincon (I think Sarah is right about that), you could make a function
res = predictData(K)
and then constrain the four variables in Aeq. This would make it easier to modify your constraints on the K values.
3 Commenti
Sarah Wait Zaranek
il 7 Mar 2011
My gut feeling is that fmincon may be faster. But in either case, he can use the set up you described above.
Matthew jones
il 7 Mar 2011
Sarah Wait Zaranek
il 7 Mar 2011
If you set up ydata to do a 2xnumber of time points matrix, then yes - MATLAB will do what you want. It will do a element-wise subtraction. The .^2 will do an element-wise power. Then when you do the first sum - you will sum over column, basically summing the sum of error squared per solution - and then the next sum will sum those two values together. Does that make sense?
Categorie
Scopri di più su Get Started with Optimization Toolbox in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!