Magnitude and direction from north and east components
24 次查看(过去 30 天)
显示 更早的评论
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
2020-4-22
编辑:Deepak Gupta
2020-4-22
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 个评论
Deepak Gupta
2020-4-22
Read comments added already and think before asking further questions. Test the code with a known values.
更多回答(1 个)
KSSV
2020-4-22
If (x,y) is a componenet
m = sqrt(x^2+y^2) ; % magnitude
theta = atan(y/x) ; % direction
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!