필터 지우기
필터 지우기

Finding multiple x-axes points from y-axes value

조회 수: 2 (최근 30일)
Kash022
Kash022 2016년 8월 3일
편집: dpb 2016년 8월 4일
Hello,
How do I find the x-values from a curve where the y-intercept cuts at 2 points? Please see attached image. I need to find the x-axes values associated with the two dropped lines for a fixed y = 10e-6 (for example)
I have tried using functions like interp1 and yval but they do not seem to work. Thanks!
  댓글 수: 3
Kash022
Kash022 2016년 8월 4일
Thank you for your reply. Please see the edited figure for more clarity. I have marked the points-of-interest with an ellipse. Yes, there are multiple lines (100) which cause the broadening. Since this is a line plot, how do I select my vector for the interp1? i.e
vq = interp1(Vgs(:,i),1e-5,p611.Xdata)
where Vgs is my x-axes, 1e-5 is the y-value of interest, and p611.Xdata refers to the line plot object.
dpb
dpb 2016년 8월 4일
OK, that's better...hmmm :( On a sample here I just learned interp1 no longer behaves the way I'm used to; what a bummer!
Looks like griddedInterpolant also doesn't work well in the inverse interpolating mode when there's reversals in magnitude; not too surprising.
I've got meetings to prepare for shortly so ran out of time right now, I'd look at fzero to find the crossing after bracketing the range I think...

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

답변 (1개)

dpb
dpb 2016년 8월 4일
편집: dpb 2016년 8월 4일
OK, try this or a version thereof...
>> y=bsxfun(@plus,randn(10),linspace(0,10,10).'); % make some sample data grossly similar...
>> yCrs=6; % set crossing level of interest
>> del=[zeros(1,10); diff(sign(y-yCrs))==2]; % find point past yCrs
>> [r,c]=ind2sub(size(del),find(del)); r=r.'; % return row for each
>> for i=1:10
xCrs(i)=interp1(y(r(i)-1:r(i),i),r(i)-1:r(i),yCrs);
end % interpolate over range
>> xCrs=[min(xCrs) max(xCrs)] % range of crossings
xCrs =
5.6484 7.4861
Above gives--
>> plot(y)
>> line(xlim,[yCrs yCrs],'linestyle',':','color','k')
>> line([xCrs(1) xCrs(1)],ylim,'linestyle',':','color','k')
>> line([xCrs(2) xCrs(2)],ylim,'linestyle',':','color','k')
ADDENDUM Depending upon just how "jaggedy" the individual lines can be, may need to do the above bounding for both first and last crossing(s) if, besides there being a sign change in the slope the observation can cross the threshold and then go back below again. That'd essentially be find with the 'first' and again with 'last' option to set the range. Then you've got the issue that will have to interpolate both sections as well since the inverse interpolation will not work with the double-valued independent variable when you turn x, y on their heads as dependent, independent variables instead. My sample data had slope reservals, but didn't actually cross below the chosen threshold; admit I didn't think of it specifically then.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by