From: Samiran on
Hi,

I am trying to fit a set of data into a model of functional form as
described below:

f(z) = c1 x (z1^c2) x (z2^c3) x (z3^c4) , where z1,z2 and z3 are the
model parameters and c1-c4 are the coefficients to be found.

This model has been written into a m-file as follows:

--------------------------------------------------------------------
function Y = monomial(C,X)
c1=C(1);
c2=C(2);
c3=C(3);
c4=C(4);
Y(:,1) = c1.*X(:,1)^c2.*X(:,2)^c3.*X(:,3)^c4;
end
--------------------------------------------------------------------

But it gave me error:

--------------------------------------------------------------------
alpha = nlinfit(X,Y,@mymodel,alpha0,options);
Caused by:
Error using ==> mpower
Matrix must be square.
--------------------------------------------------------------------

What is the meaning of this error. Please help me to solve the problem

Cheers
Sam.
From: Samiran on
On May 4, 5:15 pm, Samiran <samiran....(a)gmail.com> wrote:
> Hi,
>
> I am trying to fit a set of data into a model of functional form as
> described below:
>
> f(z) = c1 x (z1^c2) x (z2^c3) x (z3^c4) , where z1,z2 and z3 are the
> model parameters and c1-c4 are the coefficients to be found.
>
> This model has been written into a m-file as follows:
>
> --------------------------------------------------------------------
> function Y = monomial(C,X)
> c1=C(1);
> c2=C(2);
> c3=C(3);
> c4=C(4);
> Y(:,1) = c1.*X(:,1)^c2.*X(:,2)^c3.*X(:,3)^c4;
> end
> --------------------------------------------------------------------
>
> But it gave me error:
>
> --------------------------------------------------------------------
> alpha = nlinfit(X,Y,@mymodel,alpha0,options);
> Caused by:
>     Error using ==> mpower
>     Matrix must be square.
> --------------------------------------------------------------------
>
> What is the meaning of this error. Please help me to solve the problem
>
> Cheers
> Sam.

actually don't get confused with different names of function file,
i.e.' monomila' and the argument passed in nlinfit call, i.e. mymodel.
this is not the case when I tried. This is simply a typo while
copying.
From: Peter Perkins on
On 5/4/2010 8:15 AM, Samiran wrote:

> Y(:,1) = c1.*X(:,1)^c2.*X(:,2)^c3.*X(:,3)^c4;
> end
> --------------------------------------------------------------------
>
> But it gave me error:
>
> --------------------------------------------------------------------
> alpha = nlinfit(X,Y,@mymodel,alpha0,options);
> Caused by:
> Error using ==> mpower
> Matrix must be square.

Hiont:

help mpower
help power