How to find the intersection point by plotting the red line like below?

1 view (last 30 days)
how to add line and find y value like this if x is 0.1? like this
thanks

Answers (1)

Jon
Jon on 13 Feb 2020
Edited: Jon on 13 Feb 2020
Assuming you have the water level in a vector, lets call it h, along with the values of pExceed in another vector, you can interpolate to estimate the level when pExceed equals 0.1
Somthing like
hInterp = interp1(pExceed,h,0.1);
You could then plot the data
plot(pExceed,h,'-b',0.1,hInterp,'*r')
If you want the horizontal and vertical red line you can plot the box with a bar plot, so
plot(pExceed,h,'-b',0.1,hInterp,'*r')
hold on
% make a single bar, bar is centered midway between 0 and 0.1 and has a width of 0.1 to get
% the effect you want
bar(0.1/2,hInterp,0.1,'FaceColor','none','EdgeColor','red')
hold off

Community Treasure Hunt

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

Start Hunting!