【发布时间】:2015-07-14 00:48:20
【问题描述】:
我想使用 matlab 创建图,以径向方式表示质量的数值评估。
我发现的最佳方法似乎无法正常工作。运行以下代码:
theta = (0 : (360/11) : 360)*pi/180;
r = 0 : 2 : 20 ;
[TH,R] = meshgrid(theta,r);
[X,Y] = pol2cart(TH,R);
Z = meshgrid(Data);
surf(X,Y,Z);
Data 是一个包含 11 个数字的数据向量,示例数据集如下:
Data = 0.884, 0.882, 0.879, 0.880, 0.8776, 0.871, 0.8587, 0.829, 0.811, 0.803, 0.780
surf 的输出是这样的:
我想为这种类型的图像制作一个更精致的版本:
我使用以下代码生成的:
for theta = 0 : pi/100 : pi;
v = [InterpolatedImageHeight;LengthVector];
x_center = InterpolatedImageHeight((HorizontalRes+1)/2);
y_center = 0; %InterpolatedImageHeight((HorizontalRes+1)/2);
center = repmat([x_center; y_center], 1, length(InterpolatedImageHeight));
R = [cos(theta) -sin(theta); sin(theta) cos(theta)];
vo = R*(v - center) + center;
x_rotated = vo(1,:);
y_rotated = vo(2,:);
scatter(x_rotated,y_rotated,DotSize,InterpolatedData,'filled'); %x,y,area,color,properties
end
这个问题是它是一个散点图,我基本上使用plot(r,Data),绘制许多副本,并增加点大小。图形本身有很多接缝,这会占用大量内存,并且会占用大量时间,surf 或 mesh 将运行得非常快并且占用的内存最少。
如何产生具有可变颜色输入的同心环?
【问题讨论】:
标签: matlab plot polar-coordinates cartesian-coordinates