How to plot these types of plot?

2 vues (au cours des 30 derniers jours)
Athira T Das
Athira T Das le 20 Juil 2022
Commenté : Torsten le 25 Juil 2022

Réponse acceptée

Mathieu NOE
Mathieu NOE le 20 Juil 2022
hello
see my demo below. Change the profile and data scaling accorsing to your needs
hope it helps
figure(3) plot :
code :
%% create the mexican hat 3D plot
% 2D line (profile along a radius)
r = linspace(0,1,100); % radius
zs = exp(-r.^2*16); % profile (along a radius)
figure(1);
plot(r,zs);
% create the 3D plot
theta = linspace(0,2*pi,length(r));
[x,y]=pol2cart(theta, r'); % NB the transposed r to create x, y as matrices and not just vectors !!
zsr=zs'*ones(1,length(r));
figure(2);
s = surf(x,y,zsr);
s.EdgeColor = 'none';
view([0 90]);
axis('equal');
% colormap('gray');
colormap('hot');
colorbar('vert');
% interpolation on a 1024 x 1024 square grid
ll = max(r) / sqrt(2);
m = linspace(-ll,ll,1024);
[Xq,Yq] = meshgrid(m,m);
zq = griddata(x,y,zsr,Xq,Yq);
figure(3);
s = surf(Xq,Yq,zq);
s.EdgeColor = 'none';
view([0 90]);
axis('equal');
% colormap('gray');
colormap('hot');
colorbar('vert');
xlim([-ll ll]);
ylim([-ll ll]);
  2 commentaires
Athira T Das
Athira T Das le 25 Juil 2022
@Mathieu NOEwhat's the name of this type of plot?
Torsten
Torsten le 25 Juil 2022
surface plots
contour plots

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by