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

1 次查看(过去 30 天)
how to add line and find y value like this if x is 0.1? like this
thanks

回答(1 个)

Jon
Jon 2020-2-13
编辑:Jon 2020-2-13
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

类别

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