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

1 visualización (últimos 30 días)
Ming Yin Tang
Ming Yin Tang el 13 de Feb. de 2020
Editada: Jon el 13 de Feb. de 2020
how to add line and find y value like this if x is 0.1? like this
thanks

Respuestas (1)

Jon
Jon el 13 de Feb. de 2020
Editada: Jon el 13 de Feb. de 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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by