필터 지우기
필터 지우기

finding intersection point between a scatter and vertical lines

조회 수: 1 (최근 30일)
Vaultec
Vaultec 2014년 7월 4일
편집: Star Strider 2014년 7월 4일
Is there any way to find the y values of the intersection points between a scatter and vertical lines?
  댓글 수: 1
Vaultec
Vaultec 2014년 7월 4일
If possible, Im looking for something that wont require the file exchange, as my script will need to work on multiple copies of matlab

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2014년 7월 4일
편집: Star Strider 2014년 7월 4일
Use interp1. I had to do a fair amount of coding to get the data from your figure, but since you will have all the original data, you can skip directly to the YIsx = interp1 step:
openfig('figure 10.fig'); % Get figure & extract data
h1c = get(gca, 'Children');
Xdc = get(h1c, 'XData');
DSz = cellfun(@max,(cellfun(@size, Xdc, 'Uni',0))); % Get data sizes
IdxMx = find(DSz == max(DSz));
Xdmx = cell2mat(Xdc(IdxMx));
Xd = cell2mat(Xdc(setdiff(1:length(Xdc),IdxMx))); % X-values of vertical lines
Ydc = get(h1c, 'YData');
Ydmx = cell2mat(Ydc(IdxMx));
% Yd = cell2mat(Ydc);
YIsx = interp1(Xdmx, Ydmx, Xd(:,1)); % Find intersections
hold on
plot(Xd(:,1), YIsx, '+r', 'MarkerSize',10, 'LineWidth',2) % Plot intersections
hold off
produces:

추가 답변 (1개)

Ben11
Ben11 2014년 7월 4일
편집: Ben11 2014년 7월 4일
You might want to use this submission from File Exchange:
I never tried it myself but it looks great.

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by