Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Nonlinear Multivariate Regression with Multiple dependent variables and single independent variable

Subject: Nonlinear Multivariate Regression with Multiple dependent variables and single independent variable

From: Shantharam

Date: 27 Jun, 2012 02:33:08

Message: 1 of 3

I have a vector X=1:5;

Y is a matrix with each column of Y corresponding to X=1.

say Y = [1 2 3 4 5;
             2 4 6 8 10;
             3 6 9 12 15;
             4 8 12 16 20;
             5 10 15 20 25;]

so for each value of X in plane there are 5 values of X. Now I want to fit a fourth order polynomial through all these data points.

that is I have the case of X being a vector, Y being a matrix and I want to do Nonlinear regression for this case.

Please help me with the code

Thanks in Advance

Subject: Nonlinear Multivariate Regression with Multiple dependent variables and single independent variable

From: Greg Heath

Date: 27 Jun, 2012 17:45:08

Message: 2 of 3

"Shantharam " <ksramrepome@gmail.com> wrote in message <jsdrd4$4or$1@newscl01ah.mathworks.com>...
> I have a vector X=1:5;
>
> Y is a matrix with each column of Y corresponding to X=1.
>
> say Y = [1 2 3 4 5;
> 2 4 6 8 10;
> 3 6 9 12 15;
> 4 8 12 16 20;
> 5 10 15 20 25;]
>
> so for each value of X in plane there are 5 values of X. Now I want to fit a fourth order polynomial through all these data points.
>
> that is I have the case of X being a vector, Y being a matrix and I want to do Nonlinear regression for this case.
>
> Please help me with the code

What you have written makes no sense to me.

Correct your errors and please try again.

Greg

Subject: Nonlinear Multivariate Regression with Multiple dependent variables and single independent variable

From: Matt J

Date: 27 Jun, 2012 18:13:07

Message: 3 of 3

"Shantharam " <ksramrepome@gmail.com> wrote in message <jsdrd4$4or$1@newscl01ah.mathworks.com>...
> I have a vector X=1:5;
>
> Y is a matrix with each column of Y corresponding to X=1.
>
> say Y = [1 2 3 4 5;
> 2 4 6 8 10;
> 3 6 9 12 15;
> 4 8 12 16 20;
> 5 10 15 20 25;]
>
> so for each value of X in plane there are 5 values of X. Now I want to fit a fourth order polynomial through all these data points.
>
> that is I have the case of X being a vector, Y being a matrix and I want to do Nonlinear regression for this case.
=============

Not sure why this is "nonlinear". Polynomials are linear functions of the unknown coefficients. In any case, why not using polyfit:

X=1:5;
Z=nan(5);

for n=1:5
 Z(:,i)=polyfit(X,Y(:,n),4);
end

Tags for this Thread

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.

Contact us