Filling a region in the complex plane in Matlab

190 Views Asked by At

So I have plotted the the function defined implicitly by fimplicit in Matlab. I want to fill the region inside. How to do that?

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

1

There are 1 best solutions below

0
On BEST ANSWER

Here is a Matlab program which does the job:

clear all;close all;hold on
axis([-1.5 0.5 -1.5 1.5])
e=ezplot('(1+x+x^2-y^2).^2+(y+2*x*y)^2-1');
t=get(e,'ContourMatrix')
fill(t(1,2:end),t(2,2:end),'r')

Please note:

  • that I have used easyplot ("ezplot") instead of your (perfectly good) definition of function, because I am using an old release...

  • The presence of function "fill" (instead of "plot"). Take care: the first element contains size information in its first entry ; this is why we use the array of coordinates $t$ from $2$ to "end".