最困难的部分是将极坐标转换为欧氏坐标:
[x,y] = meshgrid(-5:1:5,-5:1:5);
r = sqrt(x.^2 + y.^2); % r in function of (x, y)
theta = atan2(y, x); % theta in function of (x, y)
u = r.*cos(theta); % x component of the vector field
v = r.*sin(theta); % y component of the vector field
quiver(x, y, u, v)