Gradient 基于Matlab的梯度颜色填充椭圆

Gradient 基于Matlab的梯度颜色填充椭圆,gradient,matlab-figure,fill,ellipse,drawellipse,Gradient,Matlab Figure,Fill,Ellipse,Drawellipse,我在matlab上有一个代码,它允许我绘制一系列椭圆,我试图用基于“Arcin(b/a)”的渐变颜色填充每个椭圆。数字将从0°(直线)变为90°(纯圆)。所以每个椭圆都有一个统一的颜色,但是如果这有意义的话,每个椭圆的颜色都会不同。 这是我的密码 clearvars -except data colheaders data(:,9)=data(:,9)*pi/180; % Convers Column 9 (angle of rotation) in rad data(:,6)=1196-da

我在matlab上有一个代码,它允许我绘制一系列椭圆,我试图用基于“Arcin(b/a)”的渐变颜色填充每个椭圆。数字将从0°(直线)变为90°(纯圆)。所以每个椭圆都有一个统一的颜色,但是如果这有意义的话,每个椭圆的颜色都会不同。 这是我的密码

clearvars -except data colheaders

data(:,9)=data(:,9)*pi/180; % Convers Column 9 (angle of rotation) in rad
data(:,6)=1196-data(:,6); % Reset the Y coordinate axis to bottom left

theta = 0 : 0.01 : 2*pi;

for i=1:size(data,1)
x = data(i,7)/2 * cos(theta) * cos(data(i,9)) - data(i,8)/2 * sin(theta) * sin(data(i,9)) + data(i,5);
y = data(i,8)/2 * sin(theta) * cos(data(i,9)) + data(i,7)/2 * cos(theta) * sin(data(i,9)) + data(i,6);
plot(x, y, 'LineWidth', 1);
hold on
% Columns (5,6) are the centre (x,y) of the ellipse
% Columns (7,8) are the major and minor axes (a,b)
% Column 9 is the rotation angle with the x axis

text(data(i,5),data(i,6),[num2str(i)]) % Assigns number to each ellipse
end

axis equal;
xlim([0 1592]);
ylim([0 1196]);
grid on;
如果我需要用另一种方式解释,请告诉我。 谢谢你们 多利安