MATLAB: How to calculate intersection between the domains of two functions

intersection

I have two column vectors (f and g). From this two vector how can i calculate the Delta (in picture).
The picture is just an example, I need an universal way to calculate the Delta.

Best Answer

delta = max(g)-min(f)
I mean, the value of g at y maximum - the value of f at y minimum.