这是一种方法 -
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
Run Code Online (Sandbox Code Playgroud)
输出 -

如果您希望使用白色边界填充输出,如期望输出图像中所示,您可以使用padarray-
padsize = 50; %// decides the boundary width
out = padarray(out,[padsize padsize],255);
Run Code Online (Sandbox Code Playgroud)