How to plot these types of plot?

2 visualizzazioni (ultimi 30 giorni)
Athira T Das
Athira T Das il 20 Lug 2022
Commentato: Torsten il 25 Lug 2022

Risposta accettata

Mathieu NOE
Mathieu NOE il 20 Lug 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 Commenti
Athira T Das
Athira T Das il 25 Lug 2022
@Mathieu NOEwhat's the name of this type of plot?
Torsten
Torsten il 25 Lug 2022
surface plots
contour plots

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Contour Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by