轮廓函数中的“VN”可选参数代表什么?

ban*_*013 5 matlab octave contour matlab-figure

它的文档很少(在contourc功能上):

VN要么是表示要计算的行数的标量,要么是包含行值的向量。如果只需要一个值,设置'VN = [val, val]'; 如果VN省略,则默认为10

我试过几个例子,它以某种方式影响了我轮廓周围的线条数量。
它是否表示我的函数的斜率有多平滑?
代表什么VN

Geo*_* W. 4

解释

contourc功能不会改变您的data. 它只是绘制它们。使用 VN 参数,您可以控制在绘制的地形/函数的最高点和最低点之间创建多少条等高线。

如果将 VN 设置为标量整数值,则它直接指定行数。VN=20将在地形的最高点和最低点之间创建 20 个级别。

如果指定值向量,则可以精确控制data生成等值线中的值。您应该注意这些值位于min(data(:))和之间max(data(:))。否则将不会绘制线条。示例VN=linspace(min(data(:)),max(data(:)),10)将创建与未指定 VN 完全相同的轮廓线。

例子

To illustrate the effect of VN parameter I give some examples here. I use the contour function to directly plot the lines instead of just calculating them with contourcbut the effect is the same.

% Create coordinate grid
[x,y]=meshgrid(-2:0.1:2,-2:0.1:2);
% define a contour function
z=x.^2 + 2*y.^3;
% create a figure
figure();
% plot contour
contour(x,y,z);
% make axis iso scaled
axis equal
Run Code Online (Sandbox Code Playgroud)

Example 1

Using the contour command without VN argument produces the following result

contour(x,y,z);
Run Code Online (Sandbox Code Playgroud)

<code>轮廓(x,y,z)</code>

Example 2: VN=50

Setting VN to 50 contour(x,y,z,50);

<code>轮廓(x,y,z,50)</code>

Example 3: VN= vector

Setting VN explicitly to the contour values vector is used here to limit contour lines to a rather narrow range of z data:

contour(x,y,z,linspace(-0.5,0.5,10));
Run Code Online (Sandbox Code Playgroud)

<code>轮廓(x,y,z,linspace(-0.5,0.5,10))</code>