# MATLAB: Finding zeroes of data

findfzero

How do you find zeroes from data? I have two data sets, a for acceleration and t for time. I plotted acceleration with respect to time, and I want to find when the acceleration hits zero, so at what time. I know there is fzero, but that is mainly for functions and this is just a plot from data. Do I make the data into some sort of function or can I use the find function somehow?

x = linspace(0,10*pi,1E+5);                                             % Create Datay = sin(10*pi*x.*cos(10*x).^2);                                         % Create Datazci = @(v) find(v(:).*circshift(v(:), [-1 0]) <= 0);                    % Returns Approximate Zero-Crossing Indices Of Argument Vectordy = zci(y);                                                            % Indices of Approximate Zero-Crossingsfor k1 = 1:size(dy,1)-1    b = [[1;1] [x(dy(k1)); x(dy(k1)+1)]]\[y(dy(k1)); y(dy(k1)+1)];      % Linear Fit Near Zero-Crossings    x0(k1) = -b(1)/b(2);                                                % Interpolate ‘Exact’ Zero Crossing    mb(:,k1) = b;                                                       % Store Parameter Estimates (Optional)end