I have to find the two intersection points of pdf function of normal distribution.
I have calculated all the point (x,y) for the curves by iy = pdf('normal', ix, mu, sd) and plotted them on the screen which has two intersection points.
I have tried fzero function but it does not work the means and standard deviations are different for both curves so the length of the arrays are different.
I tried simplest logic two for loops but it did not work either.
The brute force approach did not work for me because of the precision in matlab it does not consider 24.000 and 24.001 for example and the resulting values from the gaussian has 15 integers after decimal point which made it impossible for matlab to check for equality.
Trying to improve the answer as this is an accepted answer(Full credit to Eitan T who has explained beautifully in this related answer here about intersection of curves)
You’ll have to find the point of intersection (px, py) manually:
Remember that we’re comparing two numbers in floating point representation, so instead of
y1 == y2we must set a tolerance. I’ve chosen it as eps, but it’s up to you to decide.To draw a circle around this point, you can compute its points and then plot them, but a better approach would be to plot one point with a blown-up circle marker (credit to Jonas for this suggestion):
This way the dimensions of the circle are not affected by the axes and the aspect ratio of the plot.