在Matlab中填充复杂平面中的区域

问题描述

因此,我在Matlab中绘制了fimplicit隐式定义的函数。我要填充内部区域。该怎么做?

f1=@(x,y) (1+x+x.^2-y.^2).^2+(y+2.*x.*y).^2-1;

fimplicit(f1)
hold on
axis([-1.5 0.5 -1.5 1.5])
xlabel('Re(h\lambda)')
ylabel('Im(h\lambda)')
hold off

enter image description here

解决方法

只需对XData产生的YData对象的ImplicitFunctionLinefimplicit属性给出的输入使用fill

f1 = @(x,y) (1+x+x.^2-y.^2).^2+(y+2.*x.*y).^2-1;
h = fimplicit(f1,'linewidth',1);
hold on
axis([-1.5 0.5 -1.5 1.5])
xlabel('Re(h\lambda)')
ylabel('Im(h\lambda)')
fill(h.XData,h.YData,'b','FaceAlpha',.1)

enter image description here