How to avoid rounding off errors in parametrization?

Hello everyone. I am parametrizing the function of a conic: Ax^2 + By^2 + Cxy + Dx + Ey + F = 0
The goal is to get the equation to the form: x^2/a^2 + y^2/b^2 = 1
One of the steps of the parametrization corresponds to rotating and scaling about the origin, i.e., eliminate the component of xy.
This is not working very well due to roundoff errors. Being C ~= 0, here is what I have to do:
x->qx+y; y->qy-x
where
q = sqrt(((B-A)/C)^2+1) + (B-A)/C;
When I do this replacement, the xy component doesn't really disappear, it actually becomes something like
1E-5*x*y
This corrupts all of the following algorithm of the parametrization. Any ideas of how to avoid this probelm?
Thank You.

 採用された回答

Roger Stafford
Roger Stafford 2014 年 7 月 28 日
編集済み: Roger Stafford 2014 年 7 月 28 日

1 投票

First you need to get to translate to get rid of the D*x and E*y terms which I assume you have already done, which brings you to the form
A*x1^2 + B*y1^2 + C*x1*y1 + F1 = 0
Then instead of rotating with x->qx+y; y->qy-x, do this:
x1 = x2*cos(a)-y2*sin(a)
y1 = x2*sin(a)+y2*cos(a)
The coefficient of x2*y2 will then be
(B-A)*sin(2*a)+C*cos(2*a)
which you set to zero to eliminate the x2*y2 term. This gives
tan((2*a) = C/(A-B)
which you can solve with
a = 1/2*atan2(C,A-B)
Then you are nearly there.

2 件のコメント

António
António 2014 年 7 月 28 日
編集済み: António 2014 年 7 月 28 日
Thank you for the reply.
Actually, the algorithm that I was following begins by eliminating the xy component. However, this seems like a valid approach. Thank you for the help
Roger Stafford
Roger Stafford 2014 年 7 月 28 日
Yes, eliminating the D and E terms can be done either way.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by