how to convert wind direction to degrees?

Lilya · Jan 17, 2022 · 2.1K views
Question
Hi all,   I am working with wind speed and direction but the last is in form of compass, thus it required to convert it to degrees. could anyone kindly help me?   thank you in advance.
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Aug 30, 2026

You could store the names and values in arrays and look up the angle corresponding to the matching name.

 

directionValues = 0:22.5:337.5
directionNames = {'N','NNE','NE','ENE','E','ESE','SE','SSE','S','SSW','SW','WSW','W','WNW','NW','NNW'};

directionValues(strcmp(directionNames,'NNW'))

Better yet, put that in an anonymous function

compass2degree = @(dirName) directionValues(strcmp(directionNames,dirName));

compass2degree('ESE')

 

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!