InterX not accurate for one intersection point
조회 수: 13 (최근 30일)
이전 댓글 표시
I have tried to find the intersection between two lines, but it appears InterX (link below) does not return a particularly accurate value for the first intersection point. Is this the way the function works, or is it a problem with the way I am using it? Is there anyway to improve the accuracy? The code to plot the data is below and the data file is attached. The x co-ordinates are the same for both curves.
InterX: https://uk.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections
clear all
close all
clc
load rawdata.mat
points = InterX([vor_x_pdf;y_poi],[vor_x_pdf;vor_y_pdf]);
loglog(vor_x_pdf,vor_y_pdf);
hold on
loglog(vor_x_pdf,y_poi);
ylim([0.001 1]);
EDIT: I've removed the file since a solution has been given.
댓글 수: 0
답변 (1개)
jonas
2018년 9월 5일
편집: jonas
2018년 9월 5일
It's because you're comparing the points one loglog scale. I suspect InterX uses linear interpolation to find the point of intersection. Try drawing a straight line on the linear scale between two points and then look at the same line on a loglog scale. It will be curved (with some exceptions)!
댓글 수: 2
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!