In Problem 4.36 of DSP-Proakis , the task is to provide insights into harmonic distortion which may be present in practical sinusoidal generators. Consider the signal
, where .
The discrete time signal of fundamental period can consist of frequency components separated by radians or cycles (Refer Section4.2 in ).
The Fourier series coefficient at frequency is,
The total power of the signal over a period is same as the sum of the power of all the Fourier series coefficients (harmonic components) i.e.
As the signal is real valued, the power at other frequency components apart from the desired frequency component is .
Concluding, the Total Harmonic Distortion (THD) is
In the second part of the problem, the task is to generate the sinusoidal for a single period by Taylor approximation
f = 1/32;
t = repmat([0:(1/f)-1],1,1);
x = 2*pi*f*t;
n = [0:7]’;
s = factorial(2*n);
p = (-1).^n;
r = (p./s*ones(size(t))).*(ones(size(n))*x).^(2*n*ones(size(t)));
cosT = sum(r); % cosine computed from Taylor series
cosA = cos(x); % actual cosine values
The third part of the problem is to find the THD of the sinusoidals obtained from the Taylor series summation and the actual cosine function.
% compute the fourier series coefficients
k = [0:(1/f)-2]’;
refF = exp(-j*2*pi*k*t*f);
hdA = mean((ones(1/f -1,1)*cosA).*refF,2);
hdT = mean((ones(1/f -1,1)*cosT).*refF,2);
% THD from Taylor series based cosine function
THD_T = 1 – 2*abs(hdT(2)).^2/sum(cosT.^2/length(cosT))
% THD from actual cosine function
THD_A = 1 – 2*abs(hdA(2)).^2/sum(cosA.^2/length(cosA))
From a quick run of the code for different values of f, observed that the computed THD for lower frequencies is higher than that for higher frequencies. For a lower frequency signal, there are more harmonic components present in , hence the reason.
Also, as only a single period of the sinusoidal signal is considered, the signal can be treated as an aperiodic signal and hence having a continuous (and periodic) spectrum. Summarizing, apart from the power at the harmonic frequencies, the signal will be having frequency components at other portions of the spectra in .