Hi there; I am trying to make a MATLAB program to do an amplitude modulation on a biphasic pulse. The equation I am using is the following: Vout2(i)= (Vc/1000)*(1+(depth.*cos(2*pi*Fm*(i/carrier_freq)))). Where Fm is the modulating frequency, carrier_freq is the frequency of the carrier signal Vc is the carrier signal voltage There is a loop of 100 times around it. As you can see I am trying to save the voltage values in an array and I am trying to get the maximum and minimum values of the array. Then using the depth equation (Vmax-Vmin)/(Vmax+Vmin), I am trying to get the depth back to make sure that the equation is working properly. However, what I have noticed is that for different combination of Fm and carrier_freq, the depth is changing as well. For instance, if Fm is 200Hz and carrier_freq is 1200Hz @ a depth of 30%, I am getting 25.98% back from the program instead of 30% and from the oscilloscope, the depth is approximately 25%. But for values such as 100Hz Fm and 1200Hz carrier_freq, I am getting the 30% depth back both from the program and the oscilloscope. Why am I loosing the depth? I should be getting the 30% back right? I really appreciate your help. Thanks.