I have a dataset which are angles and I need to average them to smooth out the noise. Dataset - > [354,357,355,2,352,4,352] -- mean is 253.7143 ,which is wrong
Since there is a roll-off (I have 2 and 4 degrees in the dataset), how can I properly average these values so that I don't get wrong mean value?
As per penguino's answer ,
degrees to polar with r=1 and theta is degrees
x=[0.9945 0.9986 0.9962 0.9994 0.9903 0.9976 0.9903]
y=[-0.1045 -0.0523 -0.0872 0.0349 -0.1392 0.0698 -0.1392]
Avg'ed Value of x and y is [mean_x,mean_y]=[0.9953,-0.0597]
Transforming back from cartesian to polar
[theta,rho] = cart2pol(0.9953,-0.0597)theta -> -0.0599 and rho -> 0.9971
theta is in radians so, radtodeg(-0.0599) is -3.4320
Since angle is in negative , subtract from 360 i.e 360 - 3.4320 = 356.5680
356.5680 is the mean value of the dataset
The simplest solution is:
The returned value of theta is the averaged angle (in your example that would be 356.833).