The original scaling is fine, but only works for pulse-like signals.
If the original example is started with a time range of
t=linspace(0,3,100);
then the answer is not approx. 0.9, but 2.7, which is not equal to the amplitude of the given sine function.
The added scaling option still gives the correct results of 0.9, no matter which time range is used for the input time function.
The original scaling is fine, but only works for pulse-like signals.
If the original example is started with a time range of t=linspace(0,3,100); then the answer is not approx. 0.9, but 2.7, which is not equal to the amplitude of the given sine function.
The added scaling option still gives the correct results of 0.9, no matter which time range is used for the input time function.