1.
Linearity
We have two linear systems,
and
.
(a) What do these systems mean? How
do you define these systems in Matlab?
(b) Show that for any
input x[n], cascade connection of h[n] and g[n] in any order yields the same
output. Does the same property hold for nonlinear systems? If not, give an
example.
Answers:
(a) h[n] and g[n] can
be considered as impulse responses of two linear systems, i.e. as outputs of
those linear systems for an impulse in their input. Thus the outputs of these
systems are linear combinations of present and previous input values. On the
other hand, these systems can be considered as finite impulse response (FIR)
filters. You can define these systems in Matlab in the following way:
h
= [2 5 8 9];
g
= [1 2 1];
(b) Proof: For any
cascade connection of two or more linear time-invariant systems, the overall
impulse response of the cascade can be obtained by convolving the impulse
responses of all the subsystems. On the other hand, convolution is generally
commutative operation, i.e. h[n]*g[n] = g[n]*h[n]. Therefore, because the
impulse responses of the two cascades are the same, their outputs are the same
for any input x[n].
This property (commmutativity of
subsystems) does not generally hold for nonlinear systems although it holds in
some special cases (e.g. if h[n] = abs(x[n]) and g[n] = kx[n]). For example,
let h[n] = 2x[n] and g[n] = (x[n])2, where x[n] is the input of the system. In case h[n] precedes g[n],
total output will be y1[n] = 4(x[n])2. However, if g[n] precedes h[n], total output will be y2[n] = 2(x[n])2 ≠ y1[n].
2.
Complex plane
(a) Sketch the following numbers in the
complex plane: i) 5, ii)
, iii)
. How can you represent these numbers in the form
?
(b) Assume that these numbers represent
the response of a system to a sine wave. Explain in plain words how these
signals change the input signal.
(c) Express the following numbers
through their magnitude and phase: i) 2–2i, ii) i, iii) -3+2i, iv) -4-i.
Answers:
(a) We can use Euler’s formula (eiφ = cosφ + isinφ) to present these numbers in form a + ib


Figure
1: The given numbers in the complex plane
(b) The first system amplifies the signal with
factor 5, the second (response to a sine wave is
) amplifies the signal with factor 2 and the phase of the signal
changes with value 0.1p. The last system (response to a
sine wave is
) multiplies signal by 3 and produces phase reversal, i.e.
the phase of the signal changes with value p. (Actually, this means that the
signal is multiplied by -3.)
(c) Magnitude and phase of a complex number x =
a + ib can be obtained as follows:

![]()
By using the equations above, we get

3. Sampled signals
(a) In practical applications,
sampled signals are typically represented as arrays of real numbers. In
addition to the sample values themselves, what do you need to know before the
properties of a sampled signal are uniquely defined?
(b) Assume a sampling
frequency of fs = 1000 Hz for this signal, and make it represent a
30 Hz sine wave. Plot both the analog and the digitized (sampled) sine wave
with Matlab (Use the Matlab commands plot and stem). Now make
a frequency vector which contains the frequencies from 0 up to 10000 Hz. Plot
the frequency content of the sampled sine wave for this range of frequencies
(Use the Matlab command freqz(sig,1,f,fs), where f is a frequency vector and fs is the sampling frequency). Based
on the plot, what can you say about the frequency content of the sampled
signal? Note that in Matlab, we always deal with sampled signals.
Answers:
(a) Properties of a sampled signal are
uniquely defined if we know the sample values and sampling frequency.
(b) You can make a 30 Hz sine signal
(sampling frequency Fs = 1000) in Matlab:
Fs = 1000; % sampling frequency
n = 0:999 % 1000 samples of a sine signal (1 second)
f = 30; %
frequency of the sine signal
sine30_signal
= sin(2*pi*f/Fs.*n);
The analog signal
plot(n/Fs,sine30_signal);
title(‘The 30 Hz sine signal (analog)’);
xlabel(‘Time
(s)’);
The digitized (sampled) sine signal
stem(sine30_signal)
title(‘The 30 Hz sine signal (digitized)’);
xlabel(‘Samples
(n)’);
The frequency content
f =
0:10000;
freqz(sine30_signal,1,f,Fs);

Figure
2: The analog (top) and ditized (bottom) 30 Hz sine signal.

Figure
3: The frequency content of the 30 Hz digitized sine signal,the sampling
rate
is 1000 Hz.
From figure 3 we can see that the digitized
signal contains also the frequencies 970 Hz, 1030Hz, 1970 Hz, 2030 Hz etc.
(Discrete frequencies
)
4.
Convolution
Take the signal
![]()
and the system
![]()
(a) Filter
with
and call it
.
(b) Find the
frequency response of
and
. Then find the product of these frequency responses.
(c) Now compute the
frequency response of
. Compare the frequency response of
with the product of
the frequency responses of
and
.
Answers:
(a) Filtering (convolution)
x = [1 5 8
9];
h = [5 6
7];
y =
conv(h,x);
(b) Frequency responses of x[n] and h[n]
[X,W] =
freqz(x,1,512); % frequency response of x[n] calculated in 512
points
[H,W] =
freqz(h,1,512); % frequency response of h[n] calculated in 512
points
XH = X.*H; % product of X and H
(c) Frequency response of y[n]
[Y,W] =
freqz(y,1,512) % frequency response of y[n] calculated in 512
% points
plot(W/pi,abs(XH));
hold;
plot(W/pi,abs(Y),’r’);

Figure
4: X(eiw)H(eiw) (top) and Y(eiw) (bottom).
From figure 4 we can see that X(eiw)H(eiw) is equal to Y(eiw). (Convolution in time-domain is
equal to product in frequency-domain)
5.
Frequency representation of discrete signals
Take the signals
![]()
where
. Choose a couple of frequencies
and
and find
and
for k=1,2. Did you notice any difference? Based
on this, explain what range of the frequency response of a real signal is
enough to give us information about its whole frequency response? (Note that
you also have to deal with the frequencies like -0.7p and 5.3p).
Answers:
First, calculate frequency response of the
signals
and
:
Z-Transforms:

Using the substitution
, we get frequency responses:

If we choose frequencies
,
,
,
,
,and
, we get:
![]()

and

In Matlab:
x1 = [1 2 3];
x2 = [1 2+3*i 3-4*i]
[X1,W]
= freqz(x1,1,-4*pi:0.01:4*pi) % we
calculate X between frequencies % -4*pi and 4*pi
[X2,W]
= freqz(x2,1,-4*pi:0.01:4*pi) % we
calculate X between frequencies % -4*pi and 4*pi
figure(1);
plot(W/pi,abs(X1));
title(‘The
frequency response of the signal x1 (real)’);
ylabel(‘Amplitude’);
xlabel(‘Frequency
( 1 = pi)’);
figure(2);
plot(W/pi,abs(X2));
title(‘The
frequency response of the signal x2 (complex)’);
ylabel(‘Amplitude’);
xlabel(‘Frequency
( 1 = pi)’);


Figure 5: The frequency
response of the real signal x1 (top) and the
frequency response of the
complex signal x2 (bottom).
From figure 5 we can see the difference between
the amplitude responses of real and complex signals. The frequency response of
the real signal is symmetric at zero frequency, The frequency response of the
complex signal is not, although it is periodic, too. For the real signal, the
frequency range enough is from 0 to p. For complex signal, we need the
frequencies between 0 and 2p.
Designed by Dr. Peyman Arian