Question

I am trying to use the MATLAB command polar, and it seems to start with 0 degrees on the right hand side, with angles increasing in a counter-clockwise direction.

What I would like to do however, it change this, so that the polar co-ordinate system starts with 0-degrees as 'North', and the angles increase in a clockwise direction.

Is there a simple way of doing this?

EDIT: I want MATLAB to show a polar plot, where 0 starts at North, and angles are increasing in a clockwise fashion.

Était-ce utile?

La solution

Create your polar plot as usual, then call view(90, -90). This changes the viewpoint without changing anything else about the plot.

Autres conseils

Find polar.m and make a copy (I called mine mypolar.m, I found it by running polar to cause an error and clicking the link for the line number in the error message.) Edit the following lines:

Lines 133-134:

    % plot spokes
    th = (1 : 6) * 2 * pi / 12;
    cst = sin(th);
    snt = cos(th);
    cs = [-cst; cst];
    sn = [-snt; snt];

Lines 180-181:

    % transform data to Cartesian coordinates.
    xx = rho .* sin(theta);
    yy = rho .* cos(theta);

You swap sin and cos twice. I think this gets everything...

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top