Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: lsqnonlin
Replies: 2   Last Post: Feb 6, 2009 11:10 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Mike Hoversten

Posts: 13
Registered: 10/27/06
lsqnonlin
Posted: Feb 6, 2009 7:14 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

When I try the example in the docs;

First, write an M-file to compute the k-component vector F.

function F = myfun(x)
k = 1:10;
F = 2 + 2*k-exp(k*x(1))-exp(k*x(2));

Next, invoke an optimization routine.

x0 = [0.3 0.4] % Starting guess
[x,resnorm] = lsqnonlin(@myfun,x0) % Invoke optimizer

I get:

??? Undefined function or method 'lsqnonlin' for input arguments of type
'function_handle'.

Error in ==> test_main at 6
[x,resnorm] = lsqnonlin(@myfun,x0) % Invoke optimizer

what am I doing wrong?????



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.