utplotspec
used the obsolete
phase
function to compute the phase response.
In the updated version, phase
has been replaced with
a way to compute unwrapped phase using the Matlab commands unwrap
and angle
.
s(t) = exp(j pi W t2 / T) for -T/2 ≤ t ≤ T/2.
in MATLAB using the parameters in Table 10.1 on page 320.
T = 25E-6; %% pulse length 25us W = 2E6; %% swept bandwidth 2MHz fs = 20E6; %% sampling rae 20 MHz Ts = 1/fs; t = (-T/2) : Ts : (T/2); s = exp(j*pi*W*(t.^2)/T);which gives a time-bandwidth product TW = 50.
Since s(t) is complex-valued, we could plot the real part:
figure; plot(t, real(s)); xlabel( 't' );
As continuous time increases from -T/2 to 0, the chirp decreases in frequency from -W/2 to 0, and then increases in frequency from 0 to W/2 from time 0 to T/2.
The next step is to connect s(t) for -T/2 ≤ t ≤ T/2 and s[n] for 0 ≤ n ≤ N-1 where
s[n] = exp(j 2 pi alpa (n - N/2)2)
With a sampling time of Ts, the N samples in discrete time span T seconds of continuous time, i.e. T = N Ts.
The problem asks us to find correct formulas for alpha and N in terms of p and T W. We know the following:
fs = p W
Ts = 1 / fs = 1 / (p W)
T = N Ts = N / (p W)
From the last equation, we can get the relationship for N in terms of p and T W:
T W = N / p
N = p T W
Here, N has to be an integer.
The text has the following note in part (a):
(Note: It may not be possible to make the discrete-time chirp symmetric, depending on how the sampling times are defined. Starting at tn = -T/2 may not be the best strategy if t = 0 is not included in the sampling gird.)
When sampling s(t), the first sample is taken at -T/2 and the subsequent N-1 samples are taken at increments of Ts. The origin is included. However, the most positive sample time is at -T/2 + (N-1) Ts, which does not include the sample at time T/2 because that would correspond to s[N]. The value of s[0] = s(-T/2) = exp(pi T W / 4) is not zero, which means that s[n] is not conjugate symmetric about its midpoint.
To find the value for alpha in terms of p and T W, there are a couple of different ways:
Please show your work in your report. For reference, my intermediate answer is
alpha = T W / (2 N2)
and from there, you can substitute information from above to express alpha in terms of p and T W.
function s = dchirp( TW, p ) % DCHIRP generate a sampled chirp signal % usage s = dchirp( TW, p ) % s : samples of a discrete-time "chirp" signal % exp(j pi (W/T) t^2 ) for -T/2 <= t <= T/2 % TW : time-bandwidth product % p : sample at p times the Nyquist rate (W) N = p*TW; alpha = TW / (2*N^2); n = 0 : N-1; s = exp(j*2*pi*alpha*(n - N/2).^2);
utplotspec(x, Ts);where x is the discrete-time signal and Ts is the sampling time. Please use the value for Ts for the chirp signal being analyzed.
The utplotspec
function will plot a magnitude and phase of the signal's
Fourier transform vs. frequency in Hz and return the frequency-domain
samples computed by the FFT algorithm and their corresponding frequencies in Hz.
Please see Appendix A in the Mini-Project #2 assignment for more information
on the connection between the discrete-time Fourier transform and the FFT.
To find the distance, a radar system will transmit a discrete-time complex chirp pulse signal s[n] as a continuous-time signal through its antenna. After that, we process the received signal to try to detect the chirp after it bounces off a metallic object in the environment and returns to the radar. The processing applies the matched filter to the received signal and searches for a peak in the absolute value of the output signal of the matched filter. Based on the time at which the peak in the response occurs, we can estimate the round-trip delay from the radar transmission to the radar reception, and use the round-trip delay to find the distance of the object.
The matched filter is a linear time-invariant (LTI) finite impulse response (FIR) filter whose impulse response is directly related to the pulse shape to be detected. In discrete time, for a discrete-time complex-valued pulse shape s[n], the matched filter would have an impulse response
h[n] = s*[-n]
where * indicates complex conjugation and the argument -n
means to flip the signal in time.
The relevant Matlab commands are
conj
to conjugate the elements of the vector of signal values and
fliplr
to flip the vector of signal values.
You could conjugate the vector of signal values and then flip the
resulting vector, or vice-versa.
The answer will be the same either way.
By using h[n] = s*[-n], the matched filter will correlate the received signal against the pulse shape s[n]. When the correlation is high, i.e. the output of the matched filter is high enough in absolute value, the pulse has been detected. See the comments below on Exercise 2.1(c) concerning correlation.
This problem introduces a constant G without explaining what it represents. It could represent the attentuation experienced by the propagating pulse. Please set it to one.
The phrase "mainlobe" refers to the shape of the real part of the chirp pulse in the time domain around its middle values, i.e. at t = 0 for the continuous-time chirp and n = (N-1)/2 for the discrete-time chirp.
Please see Exercise 2.1(b) Hint #2 next.
s(t) = exp(j pi W t2 / T) for -T/2 ≤ t ≤ T/2.
In MATLAB, using the parameters in Table 10.1 on page 320, a vector of samples for s(t) can be defined as
T = 25E-6; %% pulse length 25us W = 2E6; %% swept bandwidth 2MHz fs = 20E6; %% sampling rae 20 MHz Ts = 1/fs; t = (-T/2) : Ts : (T/2); s = exp(j*pi*W*(t.^2)/T);To delay a signal by Td seconds, we would write mathematically
s(t - Td)
For the continuous-time chirp signal, the range of continuous-time values would be
-T/2 ≤ t - Td ≤ T/2
which is equivalent to
(-T/2) + Td ≤ t ≤ (T/2) + Td
In the MATLAB code, we could change the range of t being evaluated in the second-to-last line of the code to be
t = (-T/2) + Td : Ts : (T/2) + Td;In addition, please see Exercise 2.1(b) Hint #1 above.
oo * R [k] = Sum x[n] y [n+k] xy n=-ooThe outer discrete-time variable k indicates the shift in time between the two discrete-time signals. That is, correlation involves sliding y*[n] across x[n] and summing the result for each value of the shift, k.
Correlation is very similar to convolution:
oo * oo * R [k] = Sum x[n] y [n+k] = Sum x[n] y [k+n] xy n=-oo n=-ooIn convolution, the y*[k+n] term would be y*[k-n]. Note that the roles of k and n are reversed in correlation. We can write correlation as
* R [k] = x[n] * y [-n] xy
That is, prior to convolution, we'll flip y*[n] and convolution will flip it back. That way, we'll "fool" convolution to perform sliding y*[n] across x[n].
Autocorrelation measures how similar a signal x[n] is vs. shifts in time of itself:
oo * R [k] = Sum x[n] x [k+n] xx n=-oo
The maximum value for Rxx[k] occurs when k = 0, i.e. when x[n] is aligned with x*[n]. For a complex-valued signal x[n], the product x[n] x*[n] is the magnitude squared of x[n] because the phases subtract out.
The built-in Matlab command for correlation is xcorr
.
Using xcorr
with one argument will compute the autocorrelation.