在matlab中用梯度灰度颜色绘制圆

在matlab中用梯度灰度颜色绘制圆,matlab,Matlab,我想在matlab中用渐变色画一个圆,但我不能。有人能帮我吗 这里有一种方法- N = 200; %// this decides the size of image [X,Y] = meshgrid(-1:1/N:1, -1:1/N:1) ; nrm = sqrt(X.^2 + Y.^2); out = uint8(255*(nrm/min(nrm(:,1)))); %// output image figure, imshow(out) %// show image 输出- 如果要

我想在matlab中用渐变色画一个圆,但我不能。有人能帮我吗

这里有一种方法-

N = 200; %// this decides the size of image
[X,Y] = meshgrid(-1:1/N:1, -1:1/N:1) ;
nrm = sqrt(X.^2 + Y.^2);
out = uint8(255*(nrm/min(nrm(:,1)))); %// output image

figure, imshow(out) %// show image
输出-


如果要使用expect输出图像中所示的白色边界填充输出,可以使用-

padsize = 50; %// decides the boundary width
out = padarray(out,[padsize padsize],255);