MATLAB: Finding how many percent of data point lies below the curve.

plotting

Hi everyone,
I plotted many data points on one plot. I am trying to find out how to get the percentage or the number of how many data points lie below a certain curve that drew. Is there a way to do this in matlab?
Thank you

Best Answer

It quite likely is, but it depends on what you are doing. You didn’t go into any specifics, but if you have the curve defined at the same values of your independent variable as the data (for example, a regression curve), simply comparing the curve and the data at those points would be sufficient.
If the curve is relatively free-form, and not defined (or cannot be defined) at the same values as your independent variable, the inpolygon function would probably do what you want.