title: Extracting a signal with multiple frequency components in matlab
body: <p>If I have a signal which is a mixture of sine and cosine waves with different frequencies I can easily extract one of them by designing a band pass filter with pass band frequency equal to my desired frequency.</p>
  
  <p>What if I have to extract a signal that has more than one frequency components ?</p>
  
  <p>For example if I have two audio signals. Obviously an audio signal contains many frequencies. Let the two audio signals be a1,a2.</p>
  
  <p>Now I'm adding them like A=a1+a2;</p>
  
  <p>Note that I'm not appending one audio to another. I'm adding their amplitudes.</p>
  
  <p>For that I'm doing this :</p>
  
  <pre><code>[a1,fs1]=audioread('1.mp3');
  [a2,fs2]=audioread('sample.mp3');
  A=zeros(1,max(length(a1),length(a2)));
  for i=1:length(a1)
      A(i)=a1(i);
  end
  for i=1:length(a2)
      A(i)=A(i)+a2(i);
  end
  </code></pre>
  
  <p>Now I have a composite audio in variable <code>A</code>.</p>
  
  <p>Now if I want to extract <code>a1</code> from <code>A</code> how do I do that ? If it was a simple frequency range I would have extracted it very easily. But here both audio signals almost have <b>same set of frequencies</b>. Is it even possible t o extract like this ?</p>
  
  <p>Thankyou :)</p>
  
  <p><b>EDIT:</b></p>
  
  <p>As asked for the fourier plots here I'm pasting them :</p>
  
  <p><a href="https://i.stack.imgur.com/IC9J6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IC9J6.jpg" alt="Plot 1"></a></p>
  
  <p><a href="https://i.stack.imgur.com/3eTNv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3eTNv.jpg" alt="Plot 2"></a></p>