Digital Signal Processing Reference
In-Depth Information
The following function will generate n periods of the sequence y :
function nY = LVMakePeriodicSeq(y,N)
% LVMakePeriodicSeq([1 2 3 4],2)
y = y(:); nY = y*([ones(1,N)]); nY = nY(:)';
To illustrate use of the above, we will generate a sequence having three cycles of a cosine wave
having a period of 11 samples. One period of the desired signal is
cos(2*pi*[0:1:10]/11)
and a suitable call that computes and plots the result is therefore
N = 3; y = [cos(2*pi*[0:1:10]/11)]';
nY = LVMakePeriodicSeq(y,N); stem(nY )
2.4.7 HARMONIC SEQUENCES
Periodic signals, such as square and sawtoooth waves in a train, etc., are composed of sinusoids forming
a harmonic (or overtone, as used in music) series. A periodic wave, then, is a superposition of sinusoids
having frequencies of 1, 2, 3 ... times a fundamental frequency, with certain specific amplitudes associated
with each overtone or harmonic frequency.
A square wave may be synthesized by summing sine waves having only odd harmonics, the am-
plitudes of which diminish as the reciprocal of the harmonic number. Equation (2.1) will synthesize a
discrete time square wave having f cycles over a sequence length of N and containing odd harmonics
only up to MaxHar . Note that N , the total number of samples in the signal, must be at least equal to twice
the product of the number of cycles (of square wave) in the sequence and the highest harmonic number
to ensure that there are at least two samples per cycle of the highest frequency present in the synthesized
wave y
. The requirement that there be at least two samples per cycle of the highest frequency contained
in the signal is a general one imposed on all signals by the properties of the sampling process, and will be
studied in detail in the next chapter.
[
n
]
(MaxH ar +
1 )/ 2
[
]=
y
n
( 1 /( 2 k
1 )) sin ( 2 πf ( 2 k
1 )(n/N))
(2.1)
k
=
1
For a sawtooth wave, all harmonics are included:
MaxHar
y
[
n
]=
( 1 /k) sin ( 2 πf k(n/N))
k = 1
To illustrate the above formulas in terms of m-code, we will synthesize square and sawtooth waves
having 10 cycles, up to the 99th harmonic.
We compute the necessary minimum sequence length as 2(10)(99) = 1980. The following Math-
Script call will synthesize a square wave up to the 99th harmonic; note that only odd harmonics are
included, i.e., k = 1:2:99.
N=1980; n = 0:1:N;y=0;fork=1:2:99;
y=y+(1/k)*sin(2*pi*10*k*n/N); end; figure; plot(y)
For a sawtooth wave, the harmonic values are specified as 1:1:99, thus including both odd and
even values:
Search WWH ::




Custom Search