MATLAB Answers

Tim Bennett

Degrees or Radians for angle data?

Asked by Tim Bennett
on 3 Apr 2013

I'm calculaing regression coefficients from three sets of angle data ([1 x 20] each) as predictor variables using the following code:

X = [ones(length(x1),1)  x1'  x2'  x3'];
B = X\devY';

However, the coefficients obtained are completely different depending on whether I input the angle data as degrees or radians. Therefore,

1) Why does the change in units result in a large difference in the coefficients based on the same data? 2) The different coefficients mean I need to justify the units I will be using to calculate the coeffcients. Any help here would be appreciated.

Any help would be appreciated.


Image Analyst
on 3 Apr 2013

Do you also change the units of devY when you change the units of X?

Tim Bennett
on 4 Apr 2013

Hi Walter,

the units of devY remain the same. The X predictor variables are joint angles and the Y output variables are related to the position of the foot in meters. I've will attach the code and data i'm using below.


No products are associated with this question.

1 Answer

Answer by the cyclist
on 3 Apr 2013

Are you able to supply a small dataset that shows the problem you are talking about? As you describe it, a uniform factor (unit change) should certainly not affect the coefficients of your model.


Tim Bennett
on 4 Apr 2013

The coefficients [4 x 2] I've obtained from the angle data in degrees are as follows:

0, -0

0.0022, 0.0024

0.0033, -0.0012

0.0028, -0.0014

The coefficients [4 x 2] I've obtained from the angle data in radians are as follows:

0, -0

0.1246, 0.1384

0.189, -0.0711

0.1581, -0.0774

the cyclist
on 4 Apr 2013

Your coefficients simply differ from each other by a factor of 180/pi, the conversion from radians to degrees. This is exactly as expected.

These coefficients presumably have units, just as the inputs do.

Matt Tearle
on 4 Apr 2013

What the cyclist said. If you're solving Xb = y for b and X is in degrees and y is in meters, then b is in meters/degree. Switch X to radians and b will have to change to meters/radian as well.

Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!