Description
Lets start with the following filter:
Find the differential equation for the input x(t) and output y(t) relationship of the voltages.
Express it in discrete time by substituting for example
dt
dy(t)
for
Ts
y[n] y[n 1]
where Ts will be
the sample period.
Calculate its z transform and solve for H[z] = Y[z]/X[z]. Use R = 1000 Ω and C = 0.01 μF, and fs
= 40 000 Hz.
By using the help command in Matlab, familiarize with the command freqz
Plot its frequency response using the following:
[h,w]=freqz(b,a);
plot(40000*w/(2*pi),abs(h))
Your parameters a and b in the command above come from your derivation of H[z].
In general, in order to obtain the impulse response of a system, we would set up an experiment in
the lab where we would generate an impulse and measure the response of the system. This is not
feasible in most cases. Think of δ(t) in the frequency domain. Would noise be a good choice as a
testing signal?
Use the following type of noise X = normrnd(0,1,512,30);
That is 30 realizations of 512 Gaussian distributed samples. Instead of building an RC circuit, we
will let Matlab compute the output as
x(t) y(t)
y = filter(b,a,X);
You will be using 30 examples. Average them and see if you obtain a similar result as before.
What if you use more than 30 examples, is the result better?
Another choice of testing signal is the chirp, given that name because its “resemblance” to the
sound of some birds
x(t) = sin(2πf0(t + Kt2
)), where f0 is the initial frequency and K is a real constant.
For these type of signals the concept of Instantaneous Frequency IF is very helpful:
( )
2
1
t
dt
d
IF
, where
x(t) sin(t)
Sample a chirp (t = nTs) and use the same amount of samples N for n = 0,2, …, N-1 as before in
order to compare it with the noise input example. Choose the parameters f0 and K as to obtain the
best identification of your system. Look at the chirp in the frequency domain first and
experiment with different values, although you can derive these values theoretically from the
expression of the chirp, IF.
You can identify the system using the commands iddata and arx. Use the command help in
Matlab and familiarize with these commands. Use the chirp you created and use it as an input to
obtain the output using the results you obtained from the difference equation you found that
described the system. Afterwards, these two system identification commands should give you
similar parameters of the difference equation coefficients that you calculated theoretically. Think
of how useful it is to have input and output signals from a circuit you have no idea what it is and
that you can describe the system as easily as this. But, there is always a but, you do need the
parameters M and N and if you do not know the order of the model you may end up with
identifying a system that can give you trouble.
Problems
5.3.4 5.3.6 5.3.7 5.4.3 part (a)
5.4.10 5.5.4 5.6.5 5.8.14