how to have the final vector?
Mostrar comentarios más antiguos
Hi all,
I've written the following script to calculate the wind direction from u and v components, taking into consideration the quadrants.
The problem is that I should have the final vector for the plot.
Where am I mistaken?
Note: U10 and V10 have a dimension of (1*120).
Thanks for the help.
for i = 1:length (U10);
if(V10 > 0)
kk = ((180 / pi) * atan(U10(:,i)/V10(:,i)) + 180);
elseif (U10 < 0 & V10 < 0) ;
kk = ((180 / pi) * atan(U10(:,i)/V10(:,i)) + 0);
elseif (U10 > 0 & V10 < 0);
kk = ((180 / pi) * atan(U10(:,i)/V10(:,i)) + 360);
end
end
2 comentarios
David Hill
el 29 de Mzo. de 2020
You should look at the atan2() or atan2d() functions.
Lilya
el 29 de Mzo. de 2020
Respuesta aceptada
Más respuestas (1)
Ameer Hamza
el 29 de Mzo. de 2020
Editada: Ameer Hamza
el 29 de Mzo. de 2020
Use atan2, it takes care of the quadrants
result = atan2(U10, V10)
1 comentario
Lilya
el 29 de Mzo. de 2020
Categorías
Más información sobre Develop Apps Using App Designer en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!