|
Kai <invalid@invalid.invalid> wrote in message <6uqrorFgjn0rU1@mid.dfncis.de>...
> Hello,
>
> I'd like to optimize some parameters x that describe a kinematic model. For
> this I'm using Optimization Toolbox with Matlab.
>
> I have 10 sets of measurement data describing a position P. Now I want to
> optimize my parameters x, so that
>
> P = f(x) or for matlab 0 = f(x) - P
>
> What is the best (in terms of numerically successful) way to do this? At the
> moment, I create an array of functions f1..f10 in my optimization function
> f to use all the measurment data. So my optimization function becomes:
>
> 0 = f(x1) - P1
> 0 = f(x2) - P2
> ...
> 0 = f(x10) - P10
>
> =
>
> 0 = f_all(x) - P_all
>
> I think it's not the best way. How can I use different measurment data
> points for a optimization function in the way I described it?
Hi
I do not understand your question well. Perhaps, it is the reason why nobody answered it yet.
I guess that you have a problem:
f(x,c) = y, where
x is a vector of independent variables,
y is a vector of dependent function values,
c is a vector of unknown parameters and f() is a (non)linear function of x.
If it is your problem to solve, you have to create a function, say 'resid.m', which will evaluate residuals of the above written equation:
function res =resid(c)
global x y
res = "f(x,c)" - y; % where "f(x,c)" should be replaced by a code for your function
Global variables x and y might be transfered to the function also by another way (see documentation).
Having no Optimization Toolbox, I would use my function LMFnlsq (FEX Id 17534):
[c,ssq,cnt] = LMFnlsq('resid',c0)
c0 is your guess of possible solution of unknown coefficients c.
Should your function be linear in c, the solution would be much easier via pseudoinverse or by '\' operator.
Hope it helps.
Mira
|