Find zero crossings in each row of a matrix (321 x 123 double)
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
NotA_Programmer
am 9 Mai 2022
Kommentiert: Star Strider
am 9 Mai 2022
How can I find the no. of times the signal crosses zero. Signal is in form of a matrix (321 x 123 double), where each row represents the data one signal.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 9 Mai 2022
t = linspace(0, 5, 123); % Create Data
A = sin(randi(9,5,1)*2*pi*t/5 + 2*pi*randi(9,5,1)) % Sine Curves With Varying Phases
for k = 1:size(A,1)
zc{k} = find(diff(sign(A(k,:)),[],2)); % Zero-Crossings For Row 'k'
end
figure
plot(t,A(1,:))
hold on
plot(t(zc{1}), zeros(size(zc{1})),'+r')
hold off
grid
figure
plot(t,A(5,:))
hold on
plot(t(zc{5}), zeros(size(zc{5})),'+r')
hold off
grid
Use interp1 in a loop for each zero crossing in each row to find the exact ‘x’ values for each zero-crossing.
.
2 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Matched Filter and Ambiguity Function finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!