This is my code:
syms x y;
f= x^2/(y-y^2);
ezcontour(f,[-1,1],[0.1,0.9]);
How can i show the labels? I wan to show something like this:
Thank You very much!
This is my code:
syms x y;
f= x^2/(y-y^2);
ezcontour(f,[-1,1],[0.1,0.9]);
How can i show the labels? I wan to show something like this:
Thank You very much!
Using 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
wants as an input the contour matrix being displayed by the Contour object. While ezcontour
doesn't return the matrix like contour
does, the Contour object has a 'ContourMatrix'
property. If you specify an output for ezcontour
it will return the handle to the plotted contour that can be queried directly.
For example:
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 the desired output:
Alternatively, you can can just pass the handle to the contour to obtain the same result:
clabel([], h);
Per the documentation:
If you do not have the contour matrix
C
, then replace C with[]
.