Page 1 of 1

Problem with Peak Amplitudes Using Stackplot

Posted: Wed Sep 02, 2015 9:58 pm
by es1055
When I attempt to make a stackplot of a frequency swept simulation the peak amplitudes come out wrong. They increase going up the plot. In the attached picture, (a) shows the stackplot with the amplitude problem made using script1. (b) shows the overlapping top and bottom spectra from the stackplot. (c) is what (b) should look like and was generated using script2 which is nearly identical to script1 except that "theta1=(2.8:5:47.8);" at the top is replaced with "theta1=(2.8:45:47.8);" and "stackplot(Freq,Sim)" at the bottom is replaced with "plot(Freq,Sim)".

Re: Problem with Peak Amplitudes Using Stackplot

Posted: Thu Sep 03, 2015 9:06 pm
by es1055
The problem appears to be related to doing a stackplot on two simulations added together. If I do a stackplot of the NV or P1 simulation alone the amplitudes are correct.


Thanks.

Re: Problem with Peak Amplitudes Using Stackplot

Posted: Thu Sep 03, 2015 11:54 pm
by es1055
I stand corrected. This seems to only happen with the NV simulation. The P1 simulation is always fine unless it is added to the NV simulation and stackplotted.

Re: Problem with Peak Amplitudes Using Stackplot

Posted: Fri Sep 04, 2015 1:50 pm
by Stefan Stoll
Keep in mind that stackplot rescales the individual spectra so that they all have the same vertical extent. You can switch that scaling off:

Code: Select all

stackplot(Freq,Sim,0,2e5);
The third argument (0) gives the scaling - when set to zero, scaling is skipped.
The fourth argument gives the vertical offset between spectra. If you don't scale, you have to set this to a value that is on the same order of magnitude as the intensity in your spectra.