I know how to use least square for estimating a constant value given a bunch of measurements. It is

Alani Conner

Alani Conner

Answered question

2022-05-23

I know how to use least square for estimating a constant value given a bunch of measurements. It is the average assuming measurements have same weight of variance.
x ^ = ( H T H ) 1 H T z
where H = 1 in the case of estimating a constant value and z are a bunch of measurements. Now I would like to simulate a sensor that provides the range and the angle to a point < x , y > with some Gaussian noise. From the sensor, we can get < x , y > as follows
z 1 = r c o s θ z 2 = r s i n θ
How can I apply least square to filter z 1 and z 2 . Is H as follows
H = [ c o s θ r s i n θ s i n θ r c o s θ ]
then I apply the least square formula since I have я and H? This gives me wrong results.

Answer & Explanation

Fahrleine9m

Fahrleine9m

Beginner2022-05-24Added 11 answers

The linear least squares estimation formula you consider implies that the observation z R m and the parameter of interest x R n , ( n m), are linearly related as
z = H x + n ( 1 )
where H R m × n , and n R m is a noise vector with uncorellated elements of zero mean and equal variance.
For the sensor problem, since the sensors provide the cartesian coordinates of the point (if I understood correct), it is convenient to consider as parameter of interest the cartesian coordinates x R 2 of the point. Noting that the i-th sensor provides a measurement z i = x + n i R 2 , stacking all, say, N measurements to a single observation vector z [ z 1 T , z 2 T , , z N T ] T R 2 N results in the linear model of (1). I will leave it to you to determine the form of H R 2 N × 2 . You may then proceed in determining the LS estimate of x, from which you can then obtain an estimate of the polar coordinates by the well-known transformation formulas.
Note that the above approach estimates the polar coordinates implicitly (as a by-product of the cartesian coordinates estimate). The reason is that the polar coordinates are not linearly related to the observations (i.e., for x = [ r , θ ], you cannot find a matrix H so that (1) holds). If you wish to obtain a direct estimate of the polar coordinates from the observations you would have to perform a non-linear parameter estimation procedure.
EDIT: Since your question considers only N = 1 sensor, the estimate of the cartesian coordinates is simply z = ( z 1 , z 2 ) and the corresponding polar coordinates estimate is ( r ^ , θ ^ ) = ( z 1 2 + z 2 2 , tan 1 ( z 2 / z 1 ) )

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?