Recent Changes - Search:

Basics

Languages

Tools

OS

Resources

PmWiki

pmwiki.org

edit SideBar

View

The viewpoint defines how matlab presents a figure to you. By default, that is looking down from the positive z-axis, with the x-axis to the right, y-axis to the top in 2D view, or at a funky but convenient angle (from somewhere in the negative (x,y) quadrant and above the z=0 plane; the (-,-,+) octant!) in 3D.

Viewpoints are defined either by a pair of azimuth angle (az, measured from the negative y axis, going counter-clockwise) and angle of elevation (el, going positive above the z=0 plane). Warning: One looks from that direction towards the origin, not from the origin towards that direction!

The default viewpoints are thus:
2D: azimuth 0, elevation 90
3D: azimuth -37.5, elevation 30

Changing the viewpoint can be done using the view command and passing it either the azimuth and elevation angles, or the 3D coordinates of a point from which to look. There is more to a view than just where you are looking from, however. Similarly to how looking at something standing up or hanging upside down will change things, the observer's angle also matters.

Compare the following pairs, all of which are looking down from the positive z-axis:

az=0, el=90
Typical 2D plot figure, x increases to the right, y increases to the top
az=180, el=90
x increases to the left, y increases down
az=90, el=90
x increases down, y increases to the right
az=-90, el=90
x increases up, y increases to the left

One, rather useful view would allow you to change axes (the equivalent of plot(y,x), or making the "transpose" of a plot):

view( 90,-90)
Starting from the default [0 90], first rotate to have y increasing to the left, (but x increases down, try view(90 90)@@), then look upside down to make x increase up while y still increases right.

Because the elevation rotation is performed after the azimuth and relative to it, each pair has a unique, sometimes counter-intuitive, end result.

Edit - History - Print - Recent Changes - Search
Page last modified on June 19, 2018, at 06:03 PM