I would like to find the zeros of function given as vector. It comes from ode45.
The vector y(x) does not necessarily have point on y = 0 axis. The code below would work if the function is crossing the y = 0 from above, but what if it is tangential. The vectors resemble dumped sine wave, but not quite. Fitting with 7th degree polynomial works only for half period.
yx = find(y>0,1,'first'); % Choose 1st ‘y’ Point >0
y0 = 0;
x0 = interp1(y(yx-1:yx),x(yx-1:yx),y0); % Find Zero Cross Between `enter code here`Bracket Points