原文:http://blogs.mathworks.com/steve/2006/01/13/synthesizing-images-using-simple-equations/
MATLAB functions featured: meshgrid, cart2pol
Image Processing Toolbox functions featured: imshow
Concentric rings
x = linspace(-pi, pi, 201);
% If you pass meshgrid only one vector, it uses that vector for both the x
% and the y coordinates.
[xx, yy] = meshgrid(x);
A = 10;
I = sin(A*(xx.^2 + yy.^2));
% Specify the range -1 to 1 when displaying the image.
imshow(I, [-1 1])
Using polar coordinates
If you want to construct an image from a function of polar coordinates, use cart2pol in conjunction with meshgrid.
[xx, yy] = meshgrid(-125:125);
[theta, R] = cart2pol(xx, yy);
I = sin(50*theta);
imshow(I, [-1 1])
函数 cart2pol 是分别把 (xx(1, 1), yy(1, 1)), (xx(1, 2), yy(1, 2)), ..., (xx(n, n), yy(n, n)),为坐标的笛卡尔坐标转换为极坐标。即把对应点的坐标转换为极坐标。