positive zero crossing of a speech signal

2 views (last 30 days)
reto panda
reto panda on 4 Aug 2020
Answered: Star Strider on 4 Aug 2020
hello. I want to find locations of positive zero crossing of a speech signal . for example how in this picture how can I locate the places that signal is zero and before that was negative?

Answers (1)

Star Strider
Star Strider on 4 Aug 2020
Try this:
t = linspace(0, 1, 150); % Create Data
s = sin(2*pi*t*5); % Create Data
zci = @(y) find(diff(sign(y))); % Find Approximate Zero Crossing Indices
szx = zci(s); % Approximate Zero Crossing Indices
for k = 1:numel(szx)
idx = szx(k) + [0 1];
tzx(k) = interp1(s(idx), t(idx),0); % Interpolate To More Precise Zero-Crossings
dsdt(k) = diff(s(idx))./diff(t(idx)); % Derivative
end
figure
plot(t, s)
hold on
pzx = tzx(dsdt>0); % Derivative Greater Than 0
plot(pzx, zeros(size(pzx)),'^r')
hold off
grid
legend('Signal', 'Positive Zero Crossings')
Use your own time vector for ‘t’ and signal vector for ‘s’.
.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!