yes I modified it as a
fun = @(theta_0)(y_1 - y_2);
but it still doesn't work I get this error:
Error using fzero (line 274) The function values at the interval endpoints must differ in sign
by looking at the figure it is clear that the fun has opposite sign at first and final point. by the way I examine a smaller interval but it again has the same error.
how can I solve this?