How would a plot possibly allow you to read off an intersection, with 16 significant digits of accuracy? 2 significant digits is as much as you could hope for.
Then you tried to find the intersection by plotting a LOT of points. But did you plot the curves, and seriously look at what that plot showed?????? Did you think about what you saw?
h2
h2 =
function_handle with value:
@(theta2)(1/2*(b*theta2+sqrt(b^2*theta2.^2-theta2/M)))
ezplot(h2,[-10,10])
grid on
Be careful though. For theta between 0 and 4, your function is not real valued!
h2(1)
ans =
0.25 + 0.43301i
h2(2)
ans =
0.5 + 0.5i
So, that ezplot connected the points at 0 and 4 is not relevant.
Next, do the same for your RHS function.
ezplot(RHS)
Warning: Function failed to evaluate on array inputs; vectorizing the function may speed up its evaluation and avoid the need to loop over array elements.
> In ezplot>ezplot1 (line 488)
In ezplot (line 144)
grid on
See that this function only returns real results for theta in the OPEN interval (-0.5,0). Outside of that interval, it returns either complex results, or NaN.
At the endpoints of the open interval (-0.5,0), RHS generates NaN as a result. It is undefined.
RHS(0)
ans =
NaN
RHS(-.5)
ans =
NaN
As well, everywhere in the interval where RHS DOES return a real result, it is ALWAYS negative. Those two curves NEVER intersect. PERIOD.
Think about what you are doing. Apply common sense. Failure to do so, just trying to throw something at a computer, will generally result in garbage.
If you actually had a problem worth solving, i.e., one that had an actual solution, then I would use fzero to find the intersection. Solve the problem
h2(theta)-RHS(theta)=0.
This is irrelevant, since there is NO solution.