Adding to or Subtract From a Specifc Array Element Based on Size or Magnitude Condition
1 次查看(过去 30 天)
显示 更早的评论
I am comparing the deltas between two compass readings and both compasses are measured from 0 degrees up to 359.99 degrees. When I have a reading on Compass 1 to be 0 degrees and Compass 2 is just 2 degrees off at 358.0, the Delta (Comp2 - Comp1) is (358 - 0) or 358 degrees, but in actuality, it is only a 2 degree difference. If I perform the delta the other way (Comp1 - Comp2), I get -358 degrees. I want to initiate a condition within my program to evaluate the delta readings for the compasses and any delta over a large value, say 180 or -180 degrees, to subtract or add 360 degrees depending on the sign of the result. Can you tell me how I can do this within my delta array?
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!