Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng 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
Joined
Oct 19, 2005
Messages
1
Location
IL
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

Back
Top