MATLAB 4D(3D +彩色)剧情动画 [英] MATLAB 4D (3d + color) plot with animation
问题描述
我有3套30个数据点的X,Y,Z。我想提出的第四维度的颜色。不过,我想用第四维是不同的长度比我X,Y,Z(133比30)。
I have 3 sets of 30 data points X,Y,Z. I would like to make the 4th dimension color. However the 4th dimension I want to use is a different length than my X,Y,Z (133 vs 30).
这是一个问题,使用MATLAB中scatter3功能时,如颜色尺寸必须X的大小相匹配,Y,Z。
This is a problem when using the scatter3 function in MATLAB, as the color dimension must match the size of X,Y,Z.
我也想为电影进展.AVI格式动画这个阴谋,并有第四维(彩色)的变化。
I also want to animate this plot in .avi format, and have the 4th dimension (color) change as the movie progresses.
在此先感谢。
推荐答案
创建2D或3D矩阵来定义你的颜色:如果你使用的颜色索引到的颜色映射,或者3D,如果你想给RGB值的2D
Create a 2D or 3D matrix to define your colors: 2D if you use colors indexed into the colormap, or 3D if you want to give RGB values.
X=1:30;Y=randperm(30);Z=ones(size(X));
voltage_matrix = ...; %# 30 by 133
cdata = voltage_matrix;
handle = scatter3(X,Y,Z);
colormap('jet')
set(gca,'clim',[min(voltage_matrix) max(voltage_matrix)])
for t=1:size(cdata,2) %# 1 to 133
set(handle, 'cdata', cdata(:,t));
pause(.1)
end
编辑:注意颜色表和斧头CLIM属性。
note the colormap and axes 'clim' property.
这篇关于MATLAB 4D(3D +彩色)剧情动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!