title: Beat Signal Plot Matlab
body: <p>I'm new on Matlab and I'm trying to extract a single heartbeat from a .wav file containing several one. I already managed to display the entire .wav file but I don't find how to detect a heartbeat and especially plot it. This is what I did :</p>
  
  <pre><code>[y,fs] = audioread('myfile.wav');
  y = y(:,1);
      dt = 1/fs;
      N = length(y);
      t = linspace(0, N/fs, N);
      plot(t,y); xlabel('Seconds'); ylabel('Amplitude');
  
      threshold = 0.6; 
      if(max(y) &gt; threshold) % Here I tried to dectect the first heartbeat but it doesn't work
          plot(t1,y); % t1 should be the duration of one heartbeat
      end
  </code></pre>
  
  <p>Any ideas on how I could resolve this ? I tried this but I think it has a problem with the Matlab version : <a href="http://labrosa.ee.columbia.edu/projects/beattrack/" rel="nofollow">http://labrosa.ee.columbia.edu/projects/beattrack/</a></p>