Give me an hint
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
Hi,
I just need a hint of how to do a homework problem. Suppose I have this data: time = [1 2 3 4 5 6 7 8 9 10 11 12 13]' spike = [0 0 0 1 1 0 1 0 0 0 1 1 0]' Let me explain this. The zeros and ones indicate the presence and absence of spike, with zero being no spike and one being there is a spike. The time are in milliseconds and it corresponds to the spike. For example: there was a spike at 4msecs, 5 msecs, 7 msecs, 11msec and 12 msecs. The homework problem is to make a program to find the time in which the third spike occurred? The homework strictly states no loops allowed. Thank you
Respuestas (2)
James Tursa
el 20 de Abr. de 2015
Hint:
doc find
Chad Greene
el 20 de Abr. de 2015
Here's a hint. Run this:
% some data:
time = 1:20;
y = [1 1 0 2 3 4 3 5 6 4 3 12 3 5 4 7 4 11 15 4];
% Indices of all fours:
fours = find(y==4);
% Index of the third four:
thirdfour = fours(3);
% Time of third four:
time(thirdfour)
% plot all data:
plot(time,y,'bo')
% plot fours as red X marks:
hold on
plot(time(fours),y(fours),'rx')
xlabel('time')
box off
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!