# Filling a region in the complex plane in Matlab

11 ビュー (過去 30 日間)
Abdullah Md Saifee 2020 年 10 月 10 日

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

サインインしてコメントする。

### 回答 (2 件)

Stanislao Pinzón 2020 年 10 月 11 日
Maybe something like this:
f1=@(x,y) (1+x+x.^2-y.^2).^2+(y+2.*x.*y).^2-1;
V = fimplicit(f1);
hold on
axis([-1.5 0.5 -1.5 1.5])
xlabel('Re(h\lambda)')
ylabel('Im(h\lambda)')
fill(V.XData,V.YData,'r')
##### 0 件のコメント表示非表示 -1 件の古いコメント

サインインしてコメントする。

Walter Roberson 2020 年 10 月 11 日
This turns out to be a bit tricky.
If you record the handle
h = fimplicit(f1);
then h.XData, h.YData are the vertex lists. The vertex lists are also available in several other places inside of h.
However... the XData, YData both have embedded NaN. It looks as if each place that the function has a major change in curvature, a different nan-separated group of vertices is started.
Now, you might expect "Okay, just delete the nan out of the vertex lists!", but it turns out that the groups are not in sequence, and also that there are definite gaps between the pieces.
Often, using boundary() can be used to adapt between a set of points and a continuous line, but boundary() does not get the (concave) indentations right.
I was not able to find any properties (including hidden ones) that indicated how the segments should be joined, or what order the segments should be in.
Notice the obvious gaps.
So although it appears to be possible to get the information about the discontinuous segments, interpreting the segment information is tricky.
I have not investigated the representation for the case where there is a real discontinuity in the plot, such as cases where the implicit plot should be two elipses.

サインインしてコメントする。

R2019a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by