Splitting Wind direction into four quadrants

9 Ansichten (letzte 30 Tage)
Student new
Student new am 15 Jan. 2016
Kommentiert: Student new am 15 Jan. 2016
Hello,
I had u & V component of wind. I converted them to wind speed & direction, using
wind_speed=sqrt((u^2)+(v^2));
wind_direction=180 + atand(u/v);
The problem is wind direction is not splitting into quadrants. As done here http://wx.gmu.edu/dev/clim301/lectures/wind/wind-uv.html

Akzeptierte Antwort

Chad Greene
Chad Greene am 15 Jan. 2016
I think Kelly is partly correct. You'll need the four-quadrant version of atand, which is called atan2d.
Another quick tip: Instead of this:
wind_speed=sqrt((u^2)+(v^2));
you can use
wind_speed=hypot(u,v);
which is less prone to typos.
  1 Kommentar
Student new
Student new am 15 Jan. 2016
Bearbeitet: Student new am 15 Jan. 2016
Thanks alot Star Strider, you made my day..
You are right i was doing a mistake of (/). But i can not see comment of Star strider now..

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Kelly Kearney
Kelly Kearney am 15 Jan. 2016
As mentioned in those lecture notes, you'll need to use atan2 instead of atan (not atand either... your inputs aren't in degrees!) to get the four-quadrant result you want.
  3 Kommentare
Kelly Kearney
Kelly Kearney am 15 Jan. 2016
Right, never mind on the degrees comment. I was mistakenly reversing inputs and outputs in my head. But as Chad answered, you still need the atan2d variant.
Student new
Student new am 15 Jan. 2016
Thanks alot Kelly Kearney

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by