如何显示轮廓线中的值? clabel 不工作
How I can show the values in the contour lines? clabel not work
这是我的代码:
syms x y;
f= x^2/(y-y^2);
ezcontour(f,[-1,1],[0.1,0.9]);
如何显示标签?我想展示这样的东西:
非常感谢!
使用contour
:
x = [-1:0.01:1];
y = [0.1:0.01:0.9];
[X, Y] = meshgrid(x,y);
f= X.^2./(Y-Y.^2);
[C, h] = contour(f);
clabel(C, h);
clabel
想要 Contour object. While ezcontour
doesn't return the matrix like contour
does, the Contour object has a 'ContourMatrix'
property 显示的轮廓矩阵作为输入。如果您为 ezcontour
指定输出,它将 return 可以直接查询的绘制轮廓的句柄。
例如:
f = @(x, y) x.^2/(y-y.^2);
h = ezcontour(f, [-1, 1], [0.1, 0.9]);
C = h.ContourMatrix; % R2014b or newer
% C = get(h, 'ContourMatrix'); % R2014a and older
clabel(C, h);
Returns 期望的输出:
或者,您可以将句柄传递给轮廓以获得相同的结果:
clabel([], h);
根据文档:
If you do not have the contour matrix C
, then replace C with []
.
这是我的代码:
syms x y;
f= x^2/(y-y^2);
ezcontour(f,[-1,1],[0.1,0.9]);
如何显示标签?我想展示这样的东西:
非常感谢!
使用contour
:
x = [-1:0.01:1];
y = [0.1:0.01:0.9];
[X, Y] = meshgrid(x,y);
f= X.^2./(Y-Y.^2);
[C, h] = contour(f);
clabel(C, h);
clabel
想要 Contour object. While ezcontour
doesn't return the matrix like contour
does, the Contour object has a 'ContourMatrix'
property 显示的轮廓矩阵作为输入。如果您为 ezcontour
指定输出,它将 return 可以直接查询的绘制轮廓的句柄。
例如:
f = @(x, y) x.^2/(y-y.^2);
h = ezcontour(f, [-1, 1], [0.1, 0.9]);
C = h.ContourMatrix; % R2014b or newer
% C = get(h, 'ContourMatrix'); % R2014a and older
clabel(C, h);
Returns 期望的输出:
或者,您可以将句柄传递给轮廓以获得相同的结果:
clabel([], h);
根据文档:
If you do not have the contour matrix
C
, then replace C with[]
.