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

I have values for three different variables Z ,X,Y : how can i get the least square regression equation of Z on X and Y

Asked by mohamed on 1 Jun 2013

I have values for three different variables Z ,X,Y : how can i get the least square regression equation of Z on X and Y

0 Comments

mohamed

Products

No products are associated with this question.

2 Answers

Answer by the cyclist on 2 Jun 2013
Edited by the cyclist on 2 Jun 2013

You could use either the regress() function or the LinearModel.fit() function.

doc regress

or

doc LinearModel.fit

for details.

In each case, you'll need to combine your X and Y values into one array (predictor variables) and use Z for the response variable.

2 Comments

mohamed on 2 Jun 2013

sorry, i want to know how to combine my X and Y values into one array

the cyclist on 2 Jun 2013

If X and Y are column vectors, then you can combine them as so:

[X Y]
the cyclist
Answer by Image Analyst on 2 Jun 2013

0 Comments

Image Analyst

Contact us