title: MATLAB - Plot time-frequency graph of .wav file
body: <p>I'm working on a project that involves looking at the changes in pitch/frequency over time with a wave file (I'm new to MATLAB, but not to programming). I'm able to see the time-amplitude graph and frequency-amplitude (after an FFT) graph, but how would I be able to isolate the frequency and show it at each point in time?</p>
  
  <p>Code:</p>
  
  <pre><code>filename = '/Users/Username/Sample_1.wav'
  
  [y, fs] = wavread(filename);
  y = y(:,1);
  dt = 1/fs;
  t = 0:dt:(length(y)*dt)-dt;
  plot(t,y); xlabel('Seconds'); ylabel('Amplitude');
  
  transformed = fft(y);
  mag = abs(transformed);
  plot(mag);
  </code></pre>