image thumbnail
from MatLab Course Part-1 (AR.) by GAMAL ALKIRSHI
This is my Matlab's course in Taiz university\Yemen, it is good for students and every one who wan

Lab4_Plot3D_exa7.m
%%
%plot 3-D
%Lab4_exa7
%Gamal Gamil AL_kirshi

clear all;close all;clc;

%%
%************************plot3*************************
x=-8:0.5:8;
y=x;
[X,Y]=meshgrid(x,y);
%[X,Y]=meshgrid([-8:0.5:8]);
R=sqrt(X.^2+Y.^2)+eps;
Z=sin(R)./R;
plot3(X,Y,Z)
title('plot3(X,Y,Z)')
%%
%************************mesh*************************
figure
mesh(X,Y,Z)
title('mesh(X,Y,Z)')
%%
%************************surf*************************
figure
surf(X,Y,Z)
title('surf(X,Y,Z)')
%%
surf(X,Y,Z,'FaceColor',[0 0 0.8],'EdgeColor',[0.8 0.5 0])
camlight right; 
lighting phong
%lighting flat
%lighting gouraud
%%
figure
meshc(X,Y,Z);
%%
figure
meshz(X,Y,Z);
%%
figure
surfc(X,Y,Z);
%%
%*************** surf & mesh with peaks function
figure
Z1=peaks(X,Y);
meshc(X,Y,Z1)
%%
figure
surfc(X,Y,Z1);
%%
%************************contour*************************
figure
contour3(X,Y,Z,80)
surface(X,Y,Z,'EdgeColor',[.8 .8 .8],'FaceColor','none')
grid off
view(-15,25)
colormap cool
%%
figure
[DX,DY] = gradient(Z);
contour(X,Y,Z)
hold on
quiver(X,Y,DX,DY)
colormap hsv
hold off
%%
figure
load wind
k = 5;
x = x(:,:,k); y = y(:,:,k); u = u(:,:,k); v = v(:,:,k); 
cav = curl(x,y,u,v);
pcolor(x,y,cav); shading interp
hold on;
quiver(x,y,u,v,'k')
hold off
colormap copper
%colormap hot
%colormap cool

Contact us at files@mathworks.com