如何从X-Y坐标和z作为矩阵创建表面图(Z高)?

24 views (last 30 days)
A LL
A LL on 12 Aug 2021
评论: A LLon 12 Aug 2021
我尝试从X-Y坐标和Z作为矩阵中绘制表面图(Z高)。
X and y 是我的坐标从1到100,而z是一个矩阵,其中包含我要绘制为表面的值。
Here, my Z matrix is called mymatrix.
我试图使用 命令 PCOLOR and 冲浪 但是,而不是与 冲浪 我仍然得到相同的情节产生的智慧h PCOLOR
I have attached the figures I get as well as mymatrix
Here is what I tried:
%% pcolor command
数字(1)
clf;
抓住on;
pcolor(mymatrix);
CB =配色栏;
xlim([1 100]);
Ylim([1 100]);
title(['pcolor command'],'字体大小',24,'fontchight',,,,'大胆的');
%%冲浪命令
[X,Y] = meshgrid(1:100,1:100);
数字(2)
clf;
抓住on;
gridon;
gridminor;
xlim([1 100]);
Ylim([1 100]);
冲浪(x,y,mymatrix);
CB =配色栏;
title(['surf command'],'字体大小',24,'fontchight',,,,'大胆的');
有人知道如何制作具有高度和颜色的表面图作为我情节的第三维吗?
谢谢

接受的答案

克里斯·拉皮埃尔(Cris Lapierre)
去除 Clf and 抓住on commands from your plotting commands.
着色已经按高度完成,但是默认情况下,每个面板都是纯色,其颜色由左/底部边缘上的z值确定。将您的面积属性更改为“ Interp”以应用梯度。
加载mymatrix.mat
数字(2)
gridon
gridminor
冲浪(1:100,1:100,mymatrix,'LineStyle',,,,“没有任何”,,,,“ faceColor”,,,,"interp"
CB =配色栏;
title(['surf command'],'字体大小',24,'fontchight',,,,'大胆的'
3条评论

登录发表评论。

更多答案(1)

KSSV
KSSV on 12 Aug 2021
加载('mymatrix.mat');
冲浪(mymatrix);
shadingInterp
colorbar
3条评论

登录发表评论。

社区寻宝

在Matlab Central中找到宝藏,发现社区如何为您提供帮助!

Start Hunting!