h55095 s 00014/00000/00246 d D 1.48 23/11/03 15:49:00 bevans 48 47 c Up e s 00010/00007/00236 d D 1.47 23/11/01 14:51:36 bevans 47 46 c Up e s 00004/00000/00239 d D 1.46 23/10/31 15:28:39 bevans 46 45 c Upda e s 00003/00002/00236 d D 1.45 23/10/31 15:13:33 bevans 45 44 c Up e s 00019/00004/00219 d D 1.44 23/10/31 14:47:13 bevans 44 43 c Up e s 00002/00002/00221 d D 1.43 23/10/31 14:24:40 bevans 43 42 c Updated e s 00027/00000/00196 d D 1.42 23/10/31 14:22:41 bevans 42 41 c Updated e s 00003/00003/00193 d D 1.41 23/10/31 01:54:46 bevans 41 40 c Up e s 00036/00000/00160 d D 1.40 23/10/31 01:52:59 bevans 40 39 c Upda e s 00002/00002/00158 d D 1.39 23/10/28 11:03:09 bevans 39 38 c UpdaWelcome aboard at the American Association of University Professors! I've copied the other UT Austin AAUP officers Karma Chavez, Andrea Gore, Lauren Gutterman, Julia Mickenberg, Steven Seegel, and Polly Strong. e s 00036/00004/00124 d D 1.38 23/10/28 10:14:01 bevans 38 37 c Updated e s 00005/00000/00123 d D 1.37 23/10/28 00:13:03 bevans 37 36 c Updated e s 00005/00000/00118 d D 1.36 23/10/27 01:30:13 bevans 36 35 c Up e s 00001/00001/00117 d D 1.35 23/10/26 23:39:00 bevans 35 34 c Up e s 00004/00003/00114 d D 1.34 23/10/26 23:28:45 bevans 34 33 c Up e s 00001/00001/00116 d D 1.33 23/10/26 15:19:14 bevans 33 32 c Up e s 00048/00003/00069 d D 1.32 23/10/26 15:18:17 bevans 32 31 c Up e s 00022/00314/00050 d D 1.31 23/10/22 20:10:09 bevans 31 30 c Updated e s 00001/00001/00363 d D 1.30 21/12/03 19:01:37 bevans 30 29 c Updated e s 00009/00000/00355 d D 1.29 21/11/13 13:39:48 bevans 29 28 c Updated e s 00046/00020/00309 d D 1.28 21/11/01 17:56:06 bevans 28 27 c Updated e s 00021/00000/00308 d D 1.27 21/11/01 15:42:21 bevans 27 26 c Updated e s 00005/00001/00303 d D 1.26 21/10/31 14:24:53 bevans 26 25 c Updated e s 00010/00006/00294 d D 1.25 21/10/30 20:01:44 bevans 25 24 c Updated e s 00002/00002/00298 d D 1.24 21/10/30 18:39:04 bevans 24 23 c Updated e s 00017/00008/00283 d D 1.23 21/10/30 18:26:06 bevans 23 22 c Updated e s 00010/00002/00281 d D 1.22 21/10/29 15:24:06 bevans 22 21 c Updated e s 00010/00000/00273 d D 1.21 21/10/29 15:19:39 bevans 21 20 c Updated e s 00005/00000/00268 d D 1.20 21/10/29 08:56:09 bevans 20 19 c Updated e s 00045/00000/00223 d D 1.19 21/10/29 08:36:48 bevans 19 18 c Updated e s 00010/00006/00213 d D 1.18 21/10/28 23:09:30 bevans 18 17 c Updated e s 00026/00002/00193 d D 1.17 21/10/28 23:05:11 bevans 17 16 c Updated e s 00002/00001/00193 d D 1.16 21/10/28 22:35:58 bevans 16 15 c Updated e s 00018/00000/00176 d D 1.15 21/10/28 22:32:52 bevans 15 14 c Updated e s 00005/00004/00171 d D 1.14 21/10/28 22:14:41 bevans 14 13 c Updated e s 00001/00001/00174 d D 1.13 21/10/28 18:32:21 bevans 13 12 c Updage e s 00006/00000/00169 d D 1.12 21/10/28 18:30:41 bevans 12 11 c Updated e s 00027/00055/00142 d D 1.11 21/10/28 17:57:12 bevans 11 10 c Updated e s 00041/00002/00156 d D 1.10 21/10/28 10:53:07 bevans 10 9 c Updated e s 00012/00006/00146 d D 1.9 21/10/28 01:35:54 bevans 9 8 c Updated e s 00008/00000/00144 d D 1.8 21/10/28 00:39:50 bevans 8 7 c Updated e s 00017/00002/00127 d D 1.7 21/10/27 04:04:00 bevans 7 6 c Updated e s 00045/00003/00084 d D 1.6 21/10/27 03:01:59 bevans 6 5 c Updated e s 00002/00002/00085 d D 1.5 21/10/26 14:38:34 bevans 5 4 c Updated e s 00030/00000/00057 d D 1.4 21/10/26 14:27:50 bevans 4 3 c Updated e s 00026/00001/00031 d D 1.3 21/10/24 19:21:12 bevans 3 2 c Updated e s 00001/00028/00031 d D 1.2 21/10/24 19:14:27 bevans 2 1 c Updated e s 00059/00000/00000 d D 1.1 21/10/24 18:42:56 bevans 1 0 c date and time created 21/10/24 18:42:56 by bevans e u U f i f e 0 t T I 1
I 32 I'd recommend working in teams of two on the project.
E 32
D 31
E 38
I 38
the Linear Time Invariant Property.
E 38
Also run these demos:
I 38
E 38
E 29 I 12 D 31
utplotspec used the obsolete
phase function to compute the phase response.
In the updated version, phase has been replaced with
D 23
a way to compute unwrapped phase using the Matlab commands unwrap
and angle.
E 23
I 23
a way to compute unwrapped phase using the Matlab commands unwrap
and angle.
E 23
E 14
E 12 I 4 D 5
D 6 s(t) = exp(j pi W t^2 / T for -T/2 ≤ t ≤ T/2. E 6 I 6 s(t) = exp(j pi W t2 / T) for -T/2 ≤ t ≤ T/2. E 6
in MATLAB using the parameters in Table 10.1 on page 320. E 31 I 31
D 31 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); E 31 I 31 load filename E 31D 31 which gives a time-bandwidth product TW = 50.
Since s(t) is complex-valued, we could plot the real part: E 31 I 31 D 32 Filename should be in single quotes, e.g. E 32 I 32 Filename would use single quotes, e.g. E 32 E 31
D 31 figure; plot(t, real(s)); xlabel( 't' ); E 31 I 31 load 'echar512.mat' E 31I 31 which will load a 512 x 512 matrix
echart.
E 31
I 6 D 31 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.
E 6 The next step is to connect s(t) for -T/2 ≤ t ≤ T/2 D 6 and s[n] for 0 ≤ n ≤ N-1. E 6 I 6 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. E 6 D 7 In order to have a symmetric signal s[n] and include the origin of s(t), N will have to be odd. E 7
I 7 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.
E 7 D 6 More hints for Exercise 1.1 to follow shortly. E 6 I 6 To find the value for alpha in terms of p and T W, there are a couple of different ways:
I 6 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.
I 15
D 31 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); E 31 I 31 imread(filename) E 31
I 21 D 31
E 21 E 15 I 8 D 10
D 31 utplotspec(x, Ts); E 31 I 31 imshow(echart) E 31I 32 D 34 The
imshow command automatically scales the image --
this is similar to the soundsc command to play an
audio signal.
E 34
I 34
imshow(image) will display the image by clipping the pixel
values outside a certain range. The range depends on the data
type of the image. In our case, the image is double and the
D 35
range is [0, 1].
E 35
I 35
range is [0, 1] where 0 corresponds to black and 1 to white.
E 35
E 34
I 36 We can specify the range of pixel values to show:
imshow(echart, [0 255]);I 37 A more general way to display the full range of pixel values in an image is
imshow(echart, []);E 37
I 40 You can add a title when displaying an image by using the following code:
load echar512.mat hAxes = axes(figure); hImage = imshow(echart, [], 'Parent', hAxes); title(hAxes, 'Original echart image');
E 40 E 36 E 32 D 31 where x is the discrete-time signal and Ts is the sampling time. I 22 Please use the value for Ts for the chirp signal being analyzed. E 22 E 9
I 9
D 10
The utplotspec function will plot a magnitude and phase of the signal's
E 10
I 10
The utplotspec function will plot a magnitude and phase of the signal's
E 10
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.
I 10 D 11
D 11
The utplotspec command returns two vectors:
[ fourierInfo, contFreqValues ] = utplotspec(x, Ts);E 11 I 11
D 11 We can compute the total power in the frequency domain by summing the magnitude squared of each frequency domain sample:
totalPowerInTime = sum( abs(fourierInfo).^2 );E 11 I 11
I 21
E 21 D 11 In a similar way, we can compute the power over a range of frequencies. E 11 I 11
D 11
D 11 At any point in time, the instantaneous power is the square of the magnitude of the signal value. This is the power through a 1 Ohm resistor. To compute the total power, we can add up all of the instantaneous power:
totalPowerInTime = sum( abs(x).^2 );In a similar way, we can compute the total power in the frequency domain. For the discrete-time Fourier transform, we would have to integrate the frequency content magnitude squared from -pi to pi.
However, we can answer this problem without using Parseval's Theorem. E 11 I 11
I 17 D 28
I 23 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.
E 23 D 24 The matched filter is an linear time-invariant (LTI) finite impulse E 24 I 24 The matched filter is a linear time-invariant (LTI) finite impulse E 24 response (FIR) filter whose impulse response is directly related to the pulse shape to be detected. D 23 In discrete time, for a pulse shape s[n], the matched filter would have an impulse response h[n] equal to E 23 I 23 In discrete time, for a discrete-time complex-valued pulse shape s[n], D 25 the matched filter would have an impulse response h[n] equal to E 25 I 25 the matched filter would have an impulse response E 25 E 23
D 18 h[n] = s*(-n) E 18 I 18 h[n] = s*[-n] E 18
D 25
where * indicates complex conjugation.
The relevant Matlab commands are fliplr to flip the vector
D 18
of signal values implement the argument "-n" in s*(-n) and
E 18
I 18
of signal values implement the argument "-n" in s*[-n] and
E 18
conj to conjugate the values of the signal.
E 25
I 25
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.
E 25
I 18 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 D 25 is high in absolute value, there is a detection of the pulse. E 25 I 25 is high enough in absolute value, the pulse has been detected. E 25 I 19 See the comments below on Exercise 2.1(c) concerning correlation. E 19
I 28 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.
E 28 E 18 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.
I 28 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 E 31 I 31
D 31 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); E 31 I 31 y2 = filter(b, 1, x, [], 2); E 31I 32 Alternately, if b is a row vector, then you could use
y2 = conv2(x, b);
E 32 D 31 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 E 31 I 31 Apply a 1-D finite impulse response (FIR) filter with filter coefficients b down each column of an image x to produce a new image y1: E 31
D 31 t = (-T/2) + Td : Ts : (T/2) + Td; E 31 I 31 y1 = filter(b, 1, x, [], 1); E 31I 32 Alternately, if b is a column vector, then you could use
y1 = conv2(x, b);D 33 You can conver a row vector into a column vector using the transpose operator E 33 I 33 You can convert a row vector into a column vector using the transpose operator E 33 that is a single quote:
bcolvec= browvec';
D 38
In-Lecture assignment
In-lecture assignment #7 was intended to help you start the mini-project
E 38
I 38
Here are the visual effects after applying the first-order difference filter along each row or column of an image:
imshow(image, []) so the pixel values are displayed full scale so
that pixel values are not clipped.
E 39
I 39
Use imshow(image, []) so the pixel values are displayed full scale and
not clipped.
E 39
E 28 E 17 E 10 E 9 E 8 E 6 E 4 D 2
"Noise" is a random signal. That is, each amplitude value is a random number.
Additive thermal noise is commonly modeled as having a Gaussian distribution. Thermal noise is from random motion of electrons due to temperature. The hotter the temperature, the more motion and hence noise power there is.
In Matlab, the randn generates one real-valued random value that follows
a Gaussian (Normal) distribution with zero mean and unit variance.
The following code will create a column vector of N values of a complex normal
distribution:
N = 700; variance = 10; complexGaussianNoise = sqrt(variance/2)*(randn(N,1) + i*randn(N,1));One can check the random signal values by computing the mean, which should close to zero, and the variance, which should be close to 10:
mean(complexGaussianNoise) var(complexGaussianNoise) E 2 I 2 D 3
oo *
R [k] = Sum x[n] y [n+k]
xy n=-oo
The 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=-oo
In 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
I 20 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.
E 20
E 19
D 17
The built-in Matlab command for correlation is xcorr.
Using xcorr with one argument will compute the autocorrelation.
E 17
I 17
The built-in Matlab command for correlation is xcorr.
Using xcorr with one argument will compute the autocorrelation.
E 17
E 11
D 11 "Noise" is a random signal. That is, each amplitude value is a random number. E 11 I 11
I 27
D 28 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);In the second-to-last line, we could change the range of t being evaluated to be
t = (-T/2) + Td : Ts : (T/2) + Td;
E 28 E 27 D 11 Additive thermal noise is commonly modeled as having a Gaussian distribution. Thermal noise is from random motion of electrons due to temperature. The higher the temperature, the more motion and hence noise power there is. E 11 I 11
D 11
In Matlab, the randn generates one real-valued random value that follows
a Gaussian (Normal) distribution with zero mean and unit variance.
The following code will create a column vector of N values of a complex Normal
distribution:
E 11
I 11
D 11
N = 700; variance = 10; complexGaussianNoise = sqrt(variance/2)*(randn(N,1) + i*randn(N,1));One can check the random signal values by computing the mean, which should be close to zero, and the variance, which should be close to 10:
mean(complexGaussianNoise) var(complexGaussianNoise) E 11 I 11
E 31 E 11 E 3 E 2
I 42 Here is my code for Section 2.5:
% The load command will define a Matlab matrix echart. load echar512.mat % Display the image. hAxes = axes(figure); hImage = imshow(echart, [], 'Parent', hAxes); title(hAxes, 'Original echart image'); % Apply a first-order difference filter along the rows. % Display the resulting image. bdiffh = [1, -1]; yy1 = conv2(echart, bdiffh); hAxes1 = axes(figure); hImage1 = imshow(yy1, [], 'Parent', hAxes1); D 43 title(hAxes1, 'Image filtered with [1 -1] along rows'); E 43 I 43 title(hAxes1, 'echart image filtered with [1 -1] along the rows'); E 43 % Apply a first-order difference filter along the columns. % Display the resulting image. bdiffh = [1, -1]; yy2 = conv2(echart, bdiffh'); hAxes2 = axes(figure); hImage2 = imshow(yy2, [], 'Parent', hAxes2); D 43 title(hAxes2, 'Image filtered with [1 -1] along columns'); E 43 I 43 title(hAxes2, 'echart image filtered with [1 -1] along the columns'); E 43
E 42
D 44
% h1[n] has non-zero coefficients of 1 and -q: q = 0.9; h1 = [ 1 -q ]; % h2[n] = r^n for 0 <= n <= M and zero elsewhere: r = 0.9; M = 22; n = 0 : M; h2 = r .^ n;
I 46 Here's the ideal image restoration filter and how it relates to the one we're using.
I 48 Section 3.2.2 asks us to find the "worst case error in order to say how big the ghosts are relative to “black-white” transitions which are 0 to 255," and later in 3.3.3 we are asked to convert that error to a value in gray scale from 0 to 255. We can compute the worst case error on a pixel-by-pixel basis between image1 and image2 as follows where image1 and image2 would need to have the same dimensions:
imageDiff = image1 - image2; imageDiffAbs = abs(imageDiff); imageDiffAbsWorstCase = max(max(imageDiffAbs));Note that max(ImageDiffAbs) takes the maximum of each row of imageDiffAbs. The mean squared error (MSE) would add the entries in imageDiffAbs, and the normalized mean square error would add the entries in imageDiffAbs and divide by the number of pixels.
E 48 E 46 The lab asks you to find ways to compare two images. E 44 Matlab has several standard Image Quality Metrics:
immse to compute the mean squared error (MSE) where a lower score is better,
E 41
D 47
but the scores might not align well with human perception of quality
D 41
psnr to compute the mean squared error (PSNR) where a higher score is better,
E 41
but the scores might not align well with human perception of quality
D 41
ssim to compute the structural similarity (SSIM) index where a higher score is better,
E 41
and the scores align well with human perception of quality
E 47
I 47
but the scores might not align well with human perception of quality.
psnr to compute the peak signal-to-noise ratio (PSNR) in dB where a higher score is better,
but the scores might not align well with human perception of quality.
ssim to compute the structural similarity (SSIM) index on a scale of 0 to 1
where a higher score is better, and the scores align well with human perception of quality.
E 47
D 44
conv2 function, the images resulting from filtering echart are larger than echart,
and we can crop the resulting image to be the same size as echart:
E 47
ech90cropped = ech90(1:512, 1:512);I 44 D 45 We choose the first 512 pixels in each row because the convolution with the second filter will create a large black border on the right and on the bottom. E 45 I 45 We choose the first 512 columns in the first 512 rows because the convolution with the second filter will create large black borders on the right and on the bottom of the filtered image, and we'd like to remove the borders. I 47
You do not have to crop if you are using the filter function -- the filter
function only outputs as many samples as are in the input signal.
E 47
E 45
E 44
E 40
I 38
E 32
Last updated %G%.
Send comments to
bevans@ece.utexas.edu
E 1