对于二维隐函数绘图,我们可以使用 ezplot 函数(本质上也是描点绘图)。
关键在于函数数据的提取,参见http://www.ilovematlab.cn/thread-212297-1-1.html
然后,通过XData,YData或者contourMatrix属性获得图形的绘图数据,最后plot函数绘制。
clear;clc;
f = 'x^2+y^2=1';
h=ezplot(f);
axis square;
axis([-1 1 -1 1]);
C = get(h,'contourmatrix');
x = C(1,2:end);
y = C(2,2:end);
% Xd = get(h,'XData');
% Yd = get(h,'YData');
figure;
plot(x,y);
axis square;
axis([-1 1 -1 1]);