Magnitude and direction from north and east components

I have displacement data components along north and east how to find its magnitude and direction with reference to north(0-360) in matlab. The components may have same sign or opposite both possible.

2 件のコメント

Deepak Gupta
Deepak Gupta 2020 年 4 月 22 日
Hi Mithun,
Can you give sample data? And expected result.
TAPAS
TAPAS 2020 年 4 月 22 日
Let north=-0.34 east=0.54

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

 採用された回答

Deepak Gupta
Deepak Gupta 2020 年 4 月 22 日
編集済み: Deepak Gupta 2020 年 4 月 22 日

1 投票

Hi Mithun,
You can think of North and East as your X and Y. As you have taken north as reference so use below formulas to calculate magnitude and angle.
Magnitude = sqrt(North^2+East^2);
Theta = atan((-East)/North);
I am using -East because East is 90 degree closewise to North and atan calculates angles in counter clockwise directions from reference.
Thanks,
Deepak

5 件のコメント

TAPAS
TAPAS 2020 年 4 月 22 日
Is the direction from North and is it in the range[0, 360]
Deepak Gupta
Deepak Gupta 2020 年 4 月 22 日
編集済み: Deepak Gupta 2020 年 4 月 22 日
To caluculate direction directly between [0, 360], you can use this:
atan2d(-East,North) + 360*(-East<0)
Yes, it will give you direction in reference North direction. Try it yourself.
TAPAS
TAPAS 2020 年 4 月 22 日
Are you sure we need to do -East because we are already doing atan2d(East, north)
Deepak Gupta
Deepak Gupta 2020 年 4 月 22 日
Read comments added already and think before asking further questions. Test the code with a known values.
TAPAS
TAPAS 2020 年 4 月 23 日
Thank you

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

その他の回答 (1 件)

KSSV
KSSV 2020 年 4 月 22 日

0 投票

If (x,y) is a componenet
m = sqrt(x^2+y^2) ; % magnitude
theta = atan(y/x) ; % direction

2 件のコメント

TAPAS
TAPAS 2020 年 4 月 22 日
What should be my y??
TAPAS
TAPAS 2020 年 4 月 22 日
And shall I get the direction from North reference?

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

カテゴリ

ヘルプ センター および File ExchangeWeather and Atmospheric Science についてさらに検索

質問済み:

2020 年 4 月 22 日

コメント済み:

2020 年 4 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by