positive zero crossing of a speech signal
6 次查看(过去 30 天)
显示 更早的评论
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? ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/340969/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/340969/image.png)
0 个评论
回答(1 个)
Star Strider
2020-8-4
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’.
.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!