×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

help lsqnonlin

help lsqnonlin

help lsqnonlin

(OP)
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?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources