我有四个变量,x,y,z,t。我想以表面的形式显示 (x,y,z),这样表面的颜色由 t 决定。我想将“t”分配给颜色条。现在,颜色条对应于 z,我想让它对应于我的第四个变量“t”。
谢谢你的帮助
最佳答案
这非常简单:只需使用
surf(x, y, z, t)
来自documentation ,
surf(X,Y,Z,C)
usesC
to define color. MATLAB® performs a linear transformation on this data to obtain colors from the current colormap.
这是一个例子:
x = linspace(0,pi,50);
y = linspace(0,pi/2,50);
z = bsxfun(@times, sin(x), sin(y.')); %'
t = bsxfun(@minus, x, y.'); %'// example data;
surf(x,y,z,t); %// draw surface
colorbar %// show colorbar
关于matlab - Matlab 中的 4D 可视化(曲面和网格),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32875211/