title: MATLAB code for Harmonic Product Spectrum
body: <p>Can someone tell me how I can implement Harmonic Product Spectrum using MATLAB to find the fundamental frequency of a note in the presence of harmonics?? I know I'm supposed to downsample my signal a number of times (after performing fft of course) and then multiply them with the original signal.</p>
  
  <p>Say my fft signal is "FFT1"</p>
  
  <p>then the code would roughly be like</p>
  
  <pre><code>hps1 = downsample(FFT1,2);
  hps2 = downsample(FFT1,3);
  
  hps = FFT1.*hps1.*hps2;
  </code></pre>
  
  <p>Is this code correct??? I want to know if I've downsampled properly and since each variable has a different length multiplying them results in matrix dimension error.. I really need some real quick help as its for a project work... Really desperate.... 
  Thanx in advance....</p>