Thread Subject: How to estimate the coefficients for an equation with two variables?

Subject: How to estimate the coefficients for an equation with two variables?

From: Heinz

Date: 21 Nov, 2009 06:54:10

Message: 1 of 3

I have data values xi, yi, zi.

They follow the function:

z = f(x,y) = A*x*y^2 + B*x^2*y^2

Now I want to estimate the coefficients A and B for the best fit.

Have you any idea to do this with standard matlab? Or do I need a function of a special toolbox for this ?

Subject: How to estimate the coefficients for an equation with two variables?

From: Bruno Luong

Date: 21 Nov, 2009 07:55:14

Message: 2 of 3

"Heinz " <heinz.eppler@bizerba.com> wrote in message <he82qi$c18$1@fred.mathworks.com>...
> I have data values xi, yi, zi.
>
> They follow the function:
>
> z = f(x,y) = A*x*y^2 + B*x^2*y^2
>
> Now I want to estimate the coefficients A and B for the best fit.
>
> Have you any idea to do this with standard matlab?

Writing down the relation zi = f(xi,yi), it provides the linear equations in A and B.
Put the equations together in matrix form and solve it (in a least squares sense) using backslash. It takes one lines

AB = [x(:).*y(:).^2 x(:).^2.*y.^2] \ z(:)

Bruno

Subject: How to estimate the coefficients for an equation with two variables?

From: Heinz Eppler

Date: 24 Nov, 2009 06:48:19

Message: 3 of 3

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <he86d2$hor$1@fred.mathworks.com>...
> "Heinz " <heinz.eppler@bizerba.com> wrote in message <he82qi$c18$1@fred.mathworks.com>...
> > I have data values xi, yi, zi.
> >
> > They follow the function:
> >
> > z = f(x,y) = A*x*y^2 + B*x^2*y^2
> >
> > Now I want to estimate the coefficients A and B for the best fit.
> >
> > Have you any idea to do this with standard matlab?
>
> Writing down the relation zi = f(xi,yi), it provides the linear equations in A and B.
> Put the equations together in matrix form and solve it (in a least squares sense) using backslash. It takes one lines
>
> AB = [x(:).*y(:).^2 x(:).^2.*y.^2] \ z(:)
>
> Bruno
Thanks Bruno.

Your solution works really fine.

Best regards

Heinz

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
face detection Farie 24 Nov, 2009 03:16:43
rssFeed for this Thread

Contact us at files@mathworks.com