The ‘add_spec_nD’ function sums a series of spectra together. If the spectra do not have exactly the same set of frequency axes, then this function will calculate a common set of axes and linearly extrapolate the amplitudes in the individual spectra to obtain the amplitude for the common set of axes before adding the spectra together. Acquisition and processing parameters will be taken from the first spectrum in the series- note that adding spectra together with different acquisition and processing parameters will lead to less reliable fitting. A weight may also be included, which should have one element per spectrum.
To obtain a sum of spectra stored in a cell
spec_sum=add_spec_nD(spec_cell{:});
To take the difference of two spectra, using a weight argument
spec_diff=add_spec_nD(spec1,spec2,[1 -1]);