Code covered by the BSD License  

Highlights from
Polar/cartesian into degree north reference

Be the first to rate this file! 32 Downloads (last 30 days) File Size: 2.65 KB File ID: #23441

Polar/cartesian into degree north reference

by

 

Set of function to convert polar/cartesian coordinates into degrees north and inversely.

| Watch this File

File Information
Description

This set of function change from polar or cartesian coordinates into degrees with north reference. It also change degrees north into cartesian or polar coordinates. This is useful when working with velocity vector, e.g. current, wind.
The functions work with single values or with vectors.

The zip file contain:

- compass2pol.m: change degree north into polar coordinates.
- compass2cart.m: change degree north and velocity into u and v (cartesian coordinates).
- cart2compass.m: change u and v (cartesian coordinates) into degree north and velocity.
- pol2compass.m: change polar coordinates into degree north.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
31 Aug 2012 janez

cart2compass engine can be simplified - you don't need three 'find'-s.

degN: angle in degree north system (N = 0 degrees, E = 90 degrees)
deg: cartesian angle (E = 0 degrees, N = 90 degrees)

then it follows:

degN = 90 - deg;
idx = find(degN < 0);
degN(idx) = degN(idx) + 360;

output:
deg =

0 45 90 135 180 225 270 315 360

degN =

90 45 0 315 270 225 180 135 90

regards!

Contact us