<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264166</link>
    <title>MATLAB Central Newsreader - leastsqr problem</title>
    <description>Feed for thread: leastsqr problem</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 26 Oct 2009 20:19:06 -0400</pubDate>
      <title>leastsqr problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264166#689880</link>
      <author>Godzilla </author>
      <description>Anybody have experience with non-linear fitting, specifically using leasqr.m&lt;br&gt;
&lt;br&gt;
Here is  my function:&lt;br&gt;
%%% START&lt;br&gt;
function y = leasqrfunc(x,px)&lt;br&gt;
a = px(1);&lt;br&gt;
b = px(2);&lt;br&gt;
c = px(3);&lt;br&gt;
p = px(4);&lt;br&gt;
&lt;br&gt;
u = (x-c);&lt;br&gt;
&lt;br&gt;
y = a + b./(u.^p);&lt;br&gt;
%%% END &lt;br&gt;
&lt;br&gt;
and here is the partial derivative function (4 parameters);&lt;br&gt;
%%% START&lt;br&gt;
function y = leasqrdfdp(x,f,px,dp,func)&lt;br&gt;
% function is y = a +  b/(x-c)^p&lt;br&gt;
a = px(1);&lt;br&gt;
b = px(2);&lt;br&gt;
c = px(3);&lt;br&gt;
p = px(4);&lt;br&gt;
&lt;br&gt;
u = x-c;&lt;br&gt;
&lt;br&gt;
y = [1.0 u.^(-p) b.*(-p).*(-1).*u.^(-p-1) b.*u.^(-p).*log(u).*(-1)];&lt;br&gt;
% the above equation is all on one time&lt;br&gt;
%%%%   END&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
The program complains about ;&lt;br&gt;
&lt;br&gt;
??? Error using ==&amp;gt; horzcat&lt;br&gt;
CAT arguments dimensions are not consistent.&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; leasqrdfdp &lt;br&gt;
y = [1.0 u.^(-p) b.*(-p).*(-1).*u.^(-p-1) b.*u.^(-p).*log(u).*(-1)];&lt;br&gt;
&lt;br&gt;
I've used leasqr before without a hitch but now I can't seem to figure out what I'm doing wrong in the partial function.  I double checked the spaces between each partial and there are three spaces separating 4 partials, i.e.  one for each parameter. </description>
    </item>
  </channel>
</rss>

