How to plot these types of plot?

2 ビュー (過去 30 日間)
Athira T Das
Athira T Das 2022 年 7 月 20 日
コメント済み: Torsten 2022 年 7 月 25 日

採用された回答

Mathieu NOE
Mathieu NOE 2022 年 7 月 20 日
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 件のコメント
Athira T Das
Athira T Das 2022 年 7 月 25 日
@Mathieu NOEwhat's the name of this type of plot?
Torsten
Torsten 2022 年 7 月 25 日
surface plots
contour plots

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by