Extracting Data Points From Ezplot
조회 수: 2 (최근 30일)
이전 댓글 표시
I am plotting the following implicit function using the following code:
ezplot('(y^2)/2 + (((x^2)*y)^(1-1.2))/(1.2-1) - 2/x - 1/(1.2-1) +3/2',[0 6 0 4])
Which produces the following double-valued graphical solution:

However, I am only interested in the line that begins ~0 and increases with x. What I want to do is extract the x and corresponding y values for this line, and, despite a number of attempts, have failed in doing so thus far. Any help would be greatly appreciated.
댓글 수: 1
Star Strider
2015년 11월 10일
Rather than explot, use ezsurf to see what the routine actually calculates. Then choose the appropriate row and column of ‘XData’, ‘YData’ and ‘ZData’. (This is in R2015b. I haven’t tried it in R2014a or earlier.)
채택된 답변
Walter Roberson
2015년 11월 10일
The following might have changed as of R2014b.
In R2014a or earlier (and maybe later),
ezh = ezplot('(y^2)/2 + (((x^2)*y)^(1-1.2))/(1.2-1) - 2/x - 1/(1.2-1) +3/2',[0 6 0 4]);
ezch = get(ezh,'Children');
xd1 = get(ezch(1),'XData');
xd2 = get(ezch(2),'XData');
yd1 = get(ezch(1),'YData');
yd2 = get(ezch(2),'YData');
first_part_mask = xd2 <= 1.0;
first_x = xd2(first_part_mask);
first_y = yd2(first_part_mask);
second_part_mask = xd1 > 1.0;
second_x = xd1(second_part_mask);
second_y = yd1(second_part_mask);
both_x = [first_x(:); second_x(:)];
both_y = [first_y(:); second_y(:)];
Now the line you want is both_x together with both_y
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!