image thumbnail

MATLAB Plot Gallery - Surface Plot (2)

by

 

24 Feb 2012 (Updated )

Create a surface plot

Surface_Plot_2

This is an example of how to create a surface plot in MATLAB®.

Read about the surf function in the MATLAB documentation.

For more examples, go to MATLAB Plot Gallery

% Generate points for a cylinder with profile 2 + sin(t)
t = 0:pi/50:2*pi;
[x, y, z] = cylinder(2+sin(t));

% Create a surface plot using the surf function
figure
surf(x, y, z, 'LineStyle', 'none', 'FaceColor', 'interp')
colormap('summer')

% Turn off the axis and the grid
axis square
axis off
grid off

Contact us