Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
How can I get a matrix B of the indexes in a matrix A that satisfy the following —i representing index— A(i-1)>0 && A(i+1)<0?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
How can I get a matrix B of the indexes in a matrix A that satisfy the following —i representing index— A(i-1)>0 && A(i+1)<0?
Im ploting an oscillating graph, and would like to get indexes of rate of change closest to 0, in order to get the frequency.
0 comentarios
Respuestas (2)
Star Strider
el 24 de Dic. de 2017
‘Im ploting an oscillating graph, and would like to get indexes of rate of change closest to 0, in order to get the frequency.’
If you want to find the indices of the zero-crossings of your data, this little utility function could help:
zci = @(v) find(v(:).*circshift(v(:), [-1 0]) <= 0); % Returns Approximate Zero-Crossing Indices Of Argument Vector
0 comentarios
Roger Stafford
el 25 de Dic. de 2017
B = find(A(1:end-2)>0 & 0>A(3:end)) + 1;
Note that the "+1" is necessary here. For example. if A(1)>0 and A(3)<0, we would want to get an index of 2 included in B, but without the "+1" 'find' would record it as an index of 1.
0 comentarios
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!