Three Dimensional Plot Matlab

Three-dimensional plots generally displays a surface defined by a function in two variables, z = f(x,y) .

To evaluate z, first make a set of (x,y) points for domain of the function using meshgrid.

[X,Y] = meshgrid(-2:.2:2);

Z = X .* exp(-X.^2 - Y.^2);

Then, it will create a surface plot.

surf(X,Y,Z)

Both the surf function and mesh shows surfaces in three dimensions. surf shows both the connecting lines and the faces of the surface in color. mesh produces wireframe surfaces that color only those lines connecting the defining points.

There are various three dimensional plots in MATLAB

Mesh Plot

The mesh function makes a wireframe mesh. By default, the color of the mesh is related to the surface height.

z = peaks(25);

figure

mesh(z)

Surface Plot

The surf function is used to make a 3-D surface plot.

surf(z)

colormap(jet) % change color map

Surface Plot (with Shading)

The surfl function makes a surface plot with colormap-based lighting. For smooth color transitions, use a colormap with linear intensity variation such as pink.

surfl(z)

colormap(pink) % change color map

shading interp % interpolate colors across lines and faces

Contour Plot

The contour function is used for creation of a plot with contour lines of constant value.

contour(z,16)

colormap default % change color map

Quiver Plot

The quiver function helps to plot 2-D vectors as arrows.

x = -2:.2:2;

y = -1:.2:1;

[xx,yy] = meshgrid(x,y);

zz = xx.*exp(-xx.^2-yy.^2);

[px,py] = gradient(zz,.2,.2);

quiver(x,y,px,py)

xlim([-2.5 2.5]) % set limits of x axis

Slices through 3-D Volumes

The slice function helps to displays data at planes that slice through volumetric data.

x = -2:.2:2;

y = -2:.25:2;

z = -2:.16:2;

[x,y,z] = meshgrid(x,y,z);

v = x.*exp(-x.^2-y.^2-z.^2);

xslice = [-1.2,.8,2]; % location of y-z planes

yslice = 2; % location of x-z plane

zslice = [-2,0]; % location of x-y planes

slice(x,y,z,v,xslice,yslice,zslice)

xlabel('x')

ylabel('y')

zlabel('z')

  •   High-Quality MATLAB assignment help with Powerpoint presentations as complimentary


  •   Timely delivery of assignments with no unexpected delay from our MATLAB assignment help experts


  •   With MATLAB assignment help, you can get 24*7 assistance and direct interaction with our representatives live


  •   The coding assignments are written from scratch to eliminate chances of plagiarism by our MATLAB assignment help experts


  •   Safe and easy payment options with Paypal at MATLAB assignment help services.

Matlabsolutions.com provides guaranteed satisfaction with a commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been empanelled after extensive research and quality check.

Matlabsolutions.com provides undivided attention to each Matlab assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work done at the best price in industry.