【发布时间】:2019-11-18 03:38:05
【问题描述】:
我将如何绘制曲面:
z=(1+x^2)/(1+y^2) 覆盖区域|x|+|y|<=2 ?
我无法将曲面限制在菱形/正方形区域。
【问题讨论】:
-
你做了什么没用的?
标签: matlab plot 3d matlab-figure surface
我将如何绘制曲面:
z=(1+x^2)/(1+y^2) 覆盖区域|x|+|y|<=2 ?
我无法将曲面限制在菱形/正方形区域。
【问题讨论】:
标签: matlab plot 3d matlab-figure surface
NaN 技巧不尊重域的真实边界(在建议的答案中,精细采样隐藏了边界的粗糙度)。最好是自己生成参数化曲面,像这样(我故意用大步来突出等参数曲线)
% create a grid in the parameters domain
[U,V] = meshgrid(-1:0.2:1);
% compute actual (X,Y) values in the domain
X = U-V;
Y = U+V;
% Evaluate Z according to the equation:
Z = (1+X.^2) ./ (1+Y.^2);
% Plot:
figure(); surf(X,Y,Z, 'EdgeColor','interp');
【讨论】: