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: lsqcurvefit with matrix "xdata"
Replies: 7   Last Post: May 11, 2013 9:58 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Alan Weiss

Posts: 1,261
Registered: 11/27/08
Re: lsqcurvefit with matrix "xdata"
Posted: May 10, 2013 8:07 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 5/9/2013 3:54 PM, Jonathan wrote:
> I am trying to use lsqcurvefit to find a single parameter estimate
> with two x values per predicted y, but the result is always "Function
> value and YDATA sizes are incommensurate." Previously, when using a
> similar function with only one value for x data per predicted y the
> lsqcurvefit worked fine. The function that I am using returns the
> correct results, a single y value, when I supply a parameter. I have
> tried tinkering with the function thinking I messed it up some how,
> but to no avail.
>
> function = @(k,x) (100./(1+k.*x(1))) + (100./(1+k.*x(2)))
> x0 = .01
> ydata = <36,1> Double
> xdata = <36,2> Double
>
> I am trying to determine if the summation of two hyperbolas is enough
> to explain the ydata or if I need to consider another model.
>
> The documentation and help that I can find suggests that using a two
> variable function for lsqcurvefit is possible, but for the life of me
> I can not figure it out (where I screwed up). Thanks for any help.
>
> Jon


Did you try to run the documentation example
http://www.mathworks.com/help/optim/ug/nonlinear-curve-fitting-with-lsqcurvefit.html
Does that example run for you?

Alan Weiss
MATLAB mathematical toolbox documentation



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.