undefined
logo for matrixlab-examples.com
leftimage for matrixlab-examples.com undefined undefined undefined undefined

3D plot – Part 4


Different built-in functions to deal with tridimensional graphs.
   

In this example we make a summarization of the use of the following 3D plot instructions:

•    meshgrid
•    figure
•    contour3
•    mesh
•    surfc
•    surfl

It is better if you've already read Parts 1 to 3. We're plotting exactly the same 3D
 
data (a function depending on two variables) using several instructions, so the visualization is pretty different from each other.

Example:



% cleans the memory workspace
clc; clear; close all;

% defines the range of axes x and y
vx = -3 : 0.1 : 3;
vy = vx;

% generates the powerful grid
[x, y] = meshgrid(vx, vy);

% defines the function to be plotted
z = -10 ./ (3 + x.^2 + y.^2);

% opens figure 1 and plots the function using only contours
figure(1)
contour3(x,y,z)

% opens figure 2 and draws the function using a mesh
figure(2)
mesh(x,y,z)

% opens figure 3 and draws the function using surface with contours
figure(3)
surfc(x,y,z)

% opens figure 4 and draws the function using a enlightened surface
figure(4)
surfl(x,y,z)
shading interp
colormap hot



The resulting 3D graphics are:

Matlab 3D plot using contour3

3D plot using mesh

3D plot using surfc

3D plot using surl, with shading and colormap


From '3D Plot Part 4' to home

From '3D Plot Part 4' to 3D Main

Top

Part 1 - view, grid, subplot

Part 2 - meshgrid, plot3, meshc, surfc

Part 3 -  plot3, sphere

3D animation

undefined
undefined

footer for matlab pageundefined
undefined
undefinedundefinedundefinedundefined

undefined
undefined
undefined
undefined
undefined
undefined undefined undefined undefined undefined undefined
undefined