필터 지우기
필터 지우기

Filling a region in the complex plane in Matlab

조회 수: 3 (최근 30일)
Abdullah Md Saifee
Abdullah Md Saifee 2020년 10월 10일
답변: Walter Roberson 2020년 10월 11일
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
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')

Walter Roberson
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.
Plotting from one of the internal vertex lists. Possibly the order is start near the bottom middle, go up and left, jump across, follow down and left to bottom middle, jump to left lower middle, follow up to left upper middle, jump to right upper middle, follow down and left to right lower middle, jump across to left upper middle, follow to left center middle, jump to right center middle, follow down and right to right upper middle..
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.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by