title: Fitting gaussians to close peaks in MATLAB
body: <p>I have a data set that has two peaks close together. I'd like to fit these peaks with gaussians so that I come up with a <em>new</em> data set that replicates the original one. To this end, I am using MATLAB's "findpeaks" function, and using the heights and widths of the peaks in order to come up with the appropriate number of gaussians, and then add those gaussians together. However, because the peaks are so close together, the result looks like the following (with the original data set in blue and the replicated one in red):</p>
  
  <p><a href="https://i.stack.imgur.com/aVhrQ.png" rel="nofollow"><img src="https://i.stack.imgur.com/aVhrQ.png" alt="enter image description here"></a></p>
  
  <p>Is there a better method to replicate the data with gaussian peaks?</p>