zheka
Computer
- Oct 19, 2005
- 1
Please help me! I need to minimize an nonlinear least squares problem. I use a lsqnonlin function for this. I have such a code:
x = lsqnonlin(@myFunction, X0, [0 0], [], [], C,callR, callK, T);
where C, callR, callK are the vectors of data.
In file myFunction.m i wrote:
function F = myFunction(x, C,Ribit,K, T)
iter = 1:5;
Rf = Ribit(iter);
Ki = K(iter);
price = C(iter);
%i want to take every time another value from my vectors
%and to push it on my equatation e.t. for iter = 1 i will
%take Ribit(1), K(1), price(1); for iter = 2 i will take
%Ribit(2), K(2), price(2); and so on. Then i wrote my F
%like
F = Rf*.. + Ki*x(1)... - price
But it doesn't work.How can i solve this problem?
x = lsqnonlin(@myFunction, X0, [0 0], [], [], C,callR, callK, T);
where C, callR, callK are the vectors of data.
In file myFunction.m i wrote:
function F = myFunction(x, C,Ribit,K, T)
iter = 1:5;
Rf = Ribit(iter);
Ki = K(iter);
price = C(iter);
%i want to take every time another value from my vectors
%and to push it on my equatation e.t. for iter = 1 i will
%take Ribit(1), K(1), price(1); for iter = 2 i will take
%Ribit(2), K(2), price(2); and so on. Then i wrote my F
%like
F = Rf*.. + Ki*x(1)... - price
But it doesn't work.How can i solve this problem?