Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

help lsqnonlin

Status
Not open for further replies.

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?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor