From: Tim Wescott on
ombz wrote:
(top posting fixed)
>> On Apr 26, 11:00=A0am, "ombz" <andreas.weiskopf(a)n_o_s_p_a_m.gmail.com>
>> wrote:
>>> Hi all.
>>> I'd like to rotate a 2D-Gaussian bump. I.e. parametrize the 2D Gaussian
>>> distribution with the rotation angle phi. I first thought I could
> simply
>>> apply a rotation matrix on the covariance matrix. But my MATLAB output
>>> tells me that I'm wrong. How do I make it correctly?
>>> Thanks for your help
>>> Andreas
>> Hello Andreas,
>>
>>
>> Since the 2D gaussian has rotational symmetry, why do you want to
>> rotate it? If you are saying you have a 2D object that you want to
>> rotate in 3D, then write up the rotation equations and mathematically
>> apply them to the gaussian. You may even use Euler angles for this.
>> Let us know what you really need.
>>
>> IHTH,
>> Clay
>>
> I didn't actually mean the symmetric "gaussian", sorry. I mean a 2D
> multivariate normal distribution with covariance matrix
>
> Cov = [sigma_x^2 0
> 0 sigma_y^2]
>
> where sigma_x != sigma_y, i.e. no rotational symmetry.
>
> I was applying a rotation matrix R = [ cos(phi) -sin(phi); sin(phi)
> cos(phi) ]. But it did not rotate it.
>
> The complete cov. matrix from 2D multivariate distribution follows
>
> Cov = [sigma_x^2 rho*sigma_x*sigma_y;
> rho*sigma_x*sigma_y; sigma_y^2]
>
> Where rho is the correlation coefficient. Maybe all I'd have to do is
> parametrize rho = rho(phi) = phi/pi if phi in [-pi,pi]? Yeah, I'll
> test
> this ASAP...

Think.

You're applying the rotation to x: xr = R * x.

But by definition, if x is in n(0, Cov_x), then Cov_x is the expected
value of x times itself:
Cov_x = E{x * x^T}.

Also by definition Cov_xr is
Cov_xr = E{xr * xr^T}.

See where this is going? Tell me this isn't homework* (by telling me
what you're really doing) and I'll give you the rest. Tell me it _is_
homework and I'll give you enough help that you understand it, but not
so much that you forget it before the final.

* Sorry if my attitude strikes you as coy, but it's that time of year.

--
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
From: dvsarwate on
On Apr 26, 10:43 am, "ombz" <andreas.weiskopf(a)n_o_s_p_a_m.gmail.com>
wrote:
> I didn't actually mean the symmetric "gaussian", sorry. I mean a 2D
> multivariate normal distribution with covariance matrix
>
> Cov = [sigma_x^2     0
>           0      sigma_y^2]
>
> where sigma_x != sigma_y, i.e. no rotational symmetry.
>
> I was applying a rotation matrix R = [ cos(phi) -sin(phi); sin(phi)
> cos(phi) ]. But it did not rotate it.
>
> The complete cov. matrix from 2D multivariate distribution follows
>
> Cov = [sigma_x^2              rho*sigma_x*sigma_y;
>        rho*sigma_x*sigma_y;   sigma_y^2]
>
> Where rho is the correlation coefficient. Maybe all I'd have to do is
> parametrize rho = rho(phi) = phi/pi if phi in [-pi,pi]? Yeah, I'll test
> this ASAP...

The reverse problem -- how to rotate an arbitrary 2D
Gaussian distribution with correlated Gaussian RVs so
as to get independent Gaussian RVs -- is stated in

(http://courses.ece.illinois.edu/ECE313/spring09/homework/PS13.pdf)

and solved in

(http://courses.ece.illinois.edu/ECE313/spring09/homework/HW13.pdf)

Hope this helps.

--Dilip Sarwate




From: ombz on
@Dilip: thanks for the links - I think they'll help me to solve the
problem.

@Tim: no - this is no homework. I think the rotated distribution might help
me in a tracking problem as I'd need to have properly rotated distributions
if I want to better cope with rotation. But in this moment I think I might
even add the rotation to the distribution itself...But aah, I was never too
good in statistics.;)

Final question: how about making the distribution asymmetric? I think I'd
have to change to another type of distribution - no?

Anyway. Thanks for your help. I think I should be able to handle it now on
my own.

Best,
Andreas


>On Apr 26, 10:43=A0am, "ombz" <andreas.weiskopf(a)n_o_s_p_a_m.gmail.com>
>wrote:
>> I didn't actually mean the symmetric "gaussian", sorry. I mean a 2D
>> multivariate normal distribution with covariance matrix
>>
>> Cov =3D [sigma_x^2 =A0 =A0 0
>> =A0 =A0 =A0 =A0 =A0 0 =A0 =A0 =A0sigma_y^2]
>>
>> where sigma_x !=3D sigma_y, i.e. no rotational symmetry.
>>
>> I was applying a rotation matrix R =3D [ cos(phi) -sin(phi); sin(phi)
>> cos(phi) ]. But it did not rotate it.
>>
>> The complete cov. matrix from 2D multivariate distribution follows
>>
>> Cov =3D [sigma_x^2 =A0 =A0 =A0 =A0 =A0 =A0 =A0rho*sigma_x*sigma_y;
>> =A0 =A0 =A0 =A0rho*sigma_x*sigma_y; =A0 sigma_y^2]
>>
>> Where rho is the correlation coefficient. Maybe all I'd have to do is
>> parametrize rho =3D rho(phi) =3D phi/pi if phi in [-pi,pi]? Yeah, I'll
te=
>st
>> this ASAP...
>
>The reverse problem -- how to rotate an arbitrary 2D
>Gaussian distribution with correlated Gaussian RVs so
>as to get independent Gaussian RVs -- is stated in
>
>(http://courses.ece.illinois.edu/ECE313/spring09/homework/PS13.pdf)
>
>and solved in
>
>(http://courses.ece.illinois.edu/ECE313/spring09/homework/HW13.pdf)
>
>Hope this helps.
>
>--Dilip Sarwate
>
>
>
>
>
From: Tim Wescott on
ombz wrote:
(top posting fixed)
>> On Apr 26, 10:43=A0am, "ombz" <andreas.weiskopf(a)n_o_s_p_a_m.gmail.com>
>> wrote:
>>> I didn't actually mean the symmetric "gaussian", sorry. I mean a 2D
>>> multivariate normal distribution with covariance matrix
>>>
>>> Cov =3D [sigma_x^2 =A0 =A0 0
>>> =A0 =A0 =A0 =A0 =A0 0 =A0 =A0 =A0sigma_y^2]
>>>
>>> where sigma_x !=3D sigma_y, i.e. no rotational symmetry.
>>>
>>> I was applying a rotation matrix R =3D [ cos(phi) -sin(phi); sin(phi)
>>> cos(phi) ]. But it did not rotate it.
>>>
>>> The complete cov. matrix from 2D multivariate distribution follows
>>>
>>> Cov =3D [sigma_x^2 =A0 =A0 =A0 =A0 =A0 =A0 =A0rho*sigma_x*sigma_y;
>>> =A0 =A0 =A0 =A0rho*sigma_x*sigma_y; =A0 sigma_y^2]
>>>
>>> Where rho is the correlation coefficient. Maybe all I'd have to do is
>>> parametrize rho =3D rho(phi) =3D phi/pi if phi in [-pi,pi]? Yeah, I'll
> te=
>> st
>>> this ASAP...
>> The reverse problem -- how to rotate an arbitrary 2D
>> Gaussian distribution with correlated Gaussian RVs so
>> as to get independent Gaussian RVs -- is stated in
>>
>> (http://courses.ece.illinois.edu/ECE313/spring09/homework/PS13.pdf)
>>
>> and solved in
>>
>> (http://courses.ece.illinois.edu/ECE313/spring09/homework/HW13.pdf)
>>
>> Hope this helps.
> @Dilip: thanks for the links - I think they'll help me to solve the
> problem.
>
> @Tim: no - this is no homework. I think the rotated distribution
might help
> me in a tracking problem as I'd need to have properly rotated
distributions
> if I want to better cope with rotation. But in this moment I think I
might
> even add the rotation to the distribution itself...But aah, I was
never too
> good in statistics.;)
>
> Final question: how about making the distribution asymmetric? I think I'd
> have to change to another type of distribution - no?
>
> Anyway. Thanks for your help. I think I should be able to handle it
now on
> my own.

I'm better than a lot of people at statistics, and it can still give me
fits.

A multivariate normal distribution is, by it's nature, symmetric around
orthogonal axes. So yes, if you want an asymmetric distribution it's
gotta be something else -- and then you have to be careful about what
statistical tools you use, because so many of them only work right with
normal distributions.

--
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
From: glen herrmannsfeldt on
ombz <andreas.weiskopf(a)n_o_s_p_a_m.gmail.com> wrote:
> I didn't actually mean the symmetric "gaussian", sorry. I mean a 2D
> multivariate normal distribution with covariance matrix

> Cov = [sigma_x^2 0
> 0 sigma_y^2]

> where sigma_x != sigma_y, i.e. no rotational symmetry.

> I was applying a rotation matrix R = [ cos(phi) -sin(phi); sin(phi)
> cos(phi) ]. But it did not rotate it.

> The complete cov. matrix from 2D multivariate distribution follows

> Cov = [sigma_x^2 rho*sigma_x*sigma_y;
> rho*sigma_x*sigma_y; sigma_y^2]

> Where rho is the correlation coefficient. Maybe all I'd have to do is
> parametrize rho = rho(phi) = phi/pi if phi in [-pi,pi]? Yeah, I'll test
> this ASAP...

It seems not so for off for small rotation angles.
For larger angles, the normalization is wrong.

I think it is that statisticians think about these problems
in different ways than physicists do. The rotation form
makes sense if you believe that it really is a two dimensional
coordinate system that you are looking at from a different,
rotated orthogonal, coordinate system. If there is no
requirement that the axes be orthogonal, then that transform
doens't apply.

-- glen