2
我试图产生通过自定义功能在XY平面返回的3D矢量轮廓图,其中z = 0等高线图的三维矢量
我试过,但我只是得到一个空图:
% Stand in for the real function I want to plot.
f = @(x, y, z) [x^2, y^2, x * y + z];
x = linspace(-5, 5, 50);
y = linspace(-5, 5, 50);
z = zeros(length(x), length(y), 3);
% I know this can be vectorized but the function I really want to graph can't
% be.
for i = 1:length(x)
for j = 1:length(y)
z(i, j, :) = f(x(i), y(j), 0);
end
end
figure;
axis equal;
contour(x, y, z);
我把由'f'产生的向量的大小,这给了我想要的结果。 – Lerp