This video explains 3-D plot, surface plot and Color Map using MATLAB Live Script in R2018a version.
It shows how to draw a 3-D plot using plot3 command.
For drawing the surface plot it explains the meshgrid command and then uses Surf command to draw the surface plot for the meshed inputs and respective output, that is height of the surface plot.
This video further explains how to define colors of each vertex of surface output and edge color of the surface plot. It also explains by taking a simple example how to define colormap for the surface graph.
We will be glad to hear from you regarding any query, suggestions or appreciations at: programmerworld1990@gmail.com
Output File: MATLAB_Live_Editor_Report
Source code:
3-D Plot:
x=1:0.1:100;
y=sin(x);
z=cos(x);
plot3(x,y,z);xlabel(‘x…’);
ylabel(‘y…’);
zlabel(‘z…’);
2. Surface Plot:x=1:0.1:10;
y=x;
[X,Y] = meshgrid(x,y);Z=sin(X)+cos(Y);
% CustColor(:,:,1) = ones(91).*linspace(1,0,91); % Red
% CustColor(:,:,2) = ones(91).*linspace(0,1,91); % Green
% CustColor(:,:,3) = ones(91).*linspace(0.4,0.6,91); % Blue% surf(X,Y,Z,CustColor);
surf(X,Y,Z,’EdgeColor’,’interp’);% mymap = [0 0 0
% 1 0 0
% 0 1 0
% 0 0 1
% 1 1 1];
%
% colormap(mymap)
% colorbar;
title(‘Surface Plot … ‘)
xlabel(‘x…’);
ylabel(‘y…’);
zlabel(‘z…’);