Periodic Signals: 1. Application Goal
Periodic Signals: 1. Application Goal
Periodic Signals: 1. Application Goal
Periodic signals
1. Application goal
Periodic signals (square, sine, triangle wave) are analyzed in the frequency domain.
Signal distortion is measured at the output of signal generators for a sine wave.
a +T
x ( t ) dt =
x ( t ) dt , a R
(2)
The integral computed over one period of the function does not depend on the starting
point of the interval of integration. This is simply denoted with:
x(t )dt
T
x(t ) dt <
T
x(t ) have a finite number of extrema (maxima and minima) in any given interval T.
x(t ) has a finite number of first-order discontinuities in any given interval T.
x(t ) is bounded.
If a periodic signal of period T, fulfills Dirichlet conditions, then it can be written
as an exponential Fourier expansion:
(3)
2
x(t ) = c k e jk0t , 0 =
T
k =
with
(4)
1
c k = x(t )e jk0t dt
T
T
where c k are the exponential Fourier coefficients.
(5)
x(t ) = a 0 + (a k cos k 0 t + bk sin k 0 t )
k =1
x(t ) = A0 + Ak cos(k 0 t + k )
k =1
(6)
(7)
2
1
PX = lim
x(t ) dt
2
it is called the power of the signal x(t ) .
We can show that if x(t ) is a periodic signal of period T, then we its power is
computed over one period:
2
(8)
1
PX = x(t ) dt
T
T
ck
k =
A
2
= A0 + k
2
k =1
(9)
The first equality holds for any periodic signal; while the second one holds only for real
signals. Because the power of a sinusoid is the square of its RMS value then the power of
the periodic real signal is the sum of the power of the DC offset and the power for each
sinusoid (harmonics) in the harmonic Fourier expansion.
T T
x (t ) , t ;
x1 ( t ) =
2 2
0, otherwise
(10)
Consider X 1 ( ) the Fourier transform of the signal x1 (t ) and c k the coefficients of the
exponential Fourier expansion of the signal x(t ) . We have:
(11)
1
2
, k ]
ck = X 1 ( k 0 ) , 0 =
T
T
6. Example
Consider the square wave in figure 1.
x(t )
t
T +
T +
(12)
(12`)
1 2
A
T
Ak = 2 c k = 2 A
sin k 0 / 2
k
k = arg{c k } =
(13)
k 0
k
+ 1 sgn sin 0
2
2
, k > 0
2
Amplitude and phase spectra are shown in figure 2 for the case of / T = 1/ 4 (duty
cycle).
(15)
y (t ) = A0 + Ak cos(k 0 t + k )
k =1
Ak
Pk
2
k =2
k =2
(16)
dY =
=
A1 / 2
P1
It is square root of the ratio sum of the powers of all harmonic frequencies above the
fundamental frequency, to the power of the fundamental harmonic.
8. Practical part
We use a signal generator, an oscilloscope and a spectrum analyzer. The signal
generator is the source of a periodic signal whose waveform can be sine wave, square
wave or triangle wave. The signal generators output 50 is connected to the input of
oscilloscope (channel 1) and to the input of the spectrum analyzer.
8.1. Visualize and sketch on graph paper the waveforms for periodic signals generated
using a function generator (square, sinusoidal, triangle wave). The signals are visualized
in time on the oscilloscope and in frequency using the spectral analyzer.
Signal generator:
fundamental frequency f0=1MHz
peak-to-peak amplitude App=1V
square wave: duty factor 0.5
Oscilloscope:
Amplitude scale 0.5V/div; Time scale 0.5s/div
Spectral analyzer:
Center frequency: 5MHz;
Reference level: 10dBm
Span width: 1MHz/div;
RBW:
200kHz
8.2 Compute Fourier coefficients Ak[V] for the harmonic series for the
sinusoidal wave x ( t ) = 0.5V sin 0t (use identification),
square wave with duty factor 0.5 (use the example in figure 1),
triangle wave.
x ( t ) = A0 + Ak cos ( k 0t + k ) =
k =1
8
1
1
1
8.3 Measure the RMS values of the harmonics for all signals using a spectrum analyzer.
Use Marker and Shift Marker to read the values in dBm. Do not forget the values
are either positive or negative.
Fill in the tables:
Table I. Sine wave
F
URMS [dBm]
f0
2f0
3f0
4f0
5f0
URMS[mV]
U[mV]
Ak[mV]
Table II. Square wave, duty factor 0.5. We ignore here the harmonics of even order,
they should be very small (close to zero).
URMS[mV]
U[mV]
Ak[mV]
f
URMS [dBm]
f0
3f0
5f0
7f0
9f0
Table III. Triangle wave
f
URMS [dBm]
f0
2f0
3f0
4f0
5f0
URMS[mV]
Useful:
20 lg
U RMS [ V ]
U ref
U[mV]
Ak[mV]
= U RMS [ dBm ]
U [V ]
2
8.4 Make a graphical representation of the amplitude spectra: measured and computed.
Compare the corresponding values.
8.5 Compute the distortion of the sine wave considering the RMS values from Table I
and equation (16).
commands in a successive order that would normally be difficult to execute for iterative
programming, such as in the command line.
Functions
The first line of a function M-file starts with the keyword "function". It gives the
function name and order of arguments. It differs from a script in the sense that it can
accept input arguments, and can return output arguments. Variables defined inside the
function are local to it; only the output variables remain.
Functions are used to extend MATLAB, to create new MATLAB commands. The
general form of the first line in a function can be written as:
[ n] =
[ n n0 ] =
In MATLAB we cannot define infinite length sequences; we have to define the range for
the time n .
Define and plot in MATLAB the sequences:
1. x1 [ n ] = [ n ]
2. x2 [ n ] = [ n 1]
3. x3 [ n ] = [ n + 1] for 10 n 10 .
All vectors have 21 de elements.
8
x1.
n=-10:10;
x2=zeros(size(n));
x2(12)=1;
stem(n,x2),grid,title(x2[n]),xlabel(n)
The moment of time n =1 corresponds to the 12-th element of the vector.
x3.
n=-10:10;
x3=zeros(size(n));
x3(10)=1;
stem(n,x3),grid,title(x3[n]),xlabel(n)
The moment of time n =-1 corresponds to the 10-th element of the vector.
Exercises
Define and plot in MATLAB the sequences:
for
1 n 20
1. x1 [ n ] = 0.7 [ n 5]
2. x1 [ n ] = 0.6 [ n ]
for
15 n 15
Unit step
[ n] =
[ n n0 ] =
In MATLAB we cannot define infinite length sequences; we have to define the range for
the time n .
Define and plot in MATLAB the sequences:
1. x1 [ n ] = [ n ] for 10 n 10 .
2. x2 [ n ] = [ n 2] for 5 n 10 .
3. x3 [ n ] = [ n + 2] for 5 n 10 .
x1.
% Generate unit step
n = -10:10; % generates a vector from -10 to 10 (time)
u = [zeros(1,10) ones(1,11)]; % generates the unit step
stem(n,u); % graphical representation in discrete-time
xlabel('n');ylabel('Amplitude');
title('Unit step');
axis([-10 10 0 1.2]);
x2.
n=-5:10;
x2=[zeros(1,7),ones(1,9)];
stem(n,x2),grid,title('x_2[n]'),xlabel('n')
The moment of time n = 2 corresponds to the 18-th element of the vector.
x3.
n=-5:10;
x3=[zeros(1,3),ones(1,13)];
stem(n,x3),grid,title('x_3[n]'),xlabel('n')
The moment of time n = 2 corresponds to the 4-th element of the vector.
Exercises
Define and plot in MATLAB the sequences:
for
10 n 20
1. x1 [ n ] = 0.7 [ n ]
2. x2 [ n ] = [ n 7 ]
for
0 n 30
3. x3 [ n ] = 1.8 [ n + 3]
for
15 n 15
10