Matlab Electrical Work Engineering homework help

Person show knows matlab and electrical engineering. Message me 

1

EE417506 2022 HW 2, please see course web-page for due dates

You can read in the Anderson textbook, Digital Transmission Engineering, in Chapter 2. For

this assignment, either MATLAB or python can be used, since no special toolboxes are employed.

I strongly encourage two person teams on this assignment.

Formulas

Use my de�nition of the sinc and rect functions:

1. rect(x/X) = 1, only when |x| < X/2,(two-sided width is X and zero else.
2. sinc(x) = sin(πx)/πx., with zero-crossings ZC at the integers, ±1,±2, . . .

Remember that

rect

(
t−a
B

)
has width B, and is centered at a. Both rect and sinc are used in both the time (t) and frequency
(f) domain. Bandwidth is always de�ned over positive frequencies. The cross-correlation integral is
(`cross’ implies two di�erent signals, `auto’ implies the same signal)

Rxc(τ) =


x(t + τ)c∗(t)dt

and the output of a matched �lter to pulse s(t) at time o�set τ is

Rss(τ) =


s(τ − t)s∗(−t)dt =


s(τ + t)s∗(t)dt

and can be computed for sampled signals (vectors x and c ) using MATLAB’s xcorr.m, using Rss
= xcorr(s,s) = xcorr(s). Note that we use xcorr to produce the auto-correlation xcorr(s,s).

These can be computed in the frequency domain as

Rss(τ) =


|S(f)|2 exp(−2πfτ)df

Mnemonic: The CD-Rule. For complex valued signals (think phasors) , placement of the complex

conjugate is a matter of de�nition. The CD rule states that the Conjugate goes with the Delay.

Problem 1

We often need to put AWGN (additive white Gaussian Noise) through �lters. The general result

is that if w(t) is AWGN with spectral level No/2 (Watts per Hz), then the output of the �lter h,
given by the convolution y(t) = h(t) ∗ w(t). The output is a random process, which we take to
be wide sense stationary after all transients have decayed. The process y(t) is spectrally-shaped
Gaussian noise (zero-mean), with spectrum

Sy(f) =
No
2
|H(f)|2, and average power Py =

No
2
Eh

where Eh < ∞ is the energy in the �lter h(t). This can be calculated in the time or frequency
domain, since by Parseval

Eh =


|h(t)|2dt =


|H(f)|2df

Although AWGN has in�nite power, the output process y(t) has �nite power Py. Since noise is
zero-mean and Gaussian (normally) distributed, this means the RMS value is σy =


Py, and one

2

can compute the probability that the noise exceeds a given level. With MATLAB, for a random

variable RV x with a zero mean Gaussian distribution with variance σ2, we can compute, using
erfc.m.

P{x > a} = Q(
a

σ
) =

1

2
erfc(

a/σ

2
)

So, most of these computations, reduce to calculating the power out of the process, since σ2y = Py.
Compute the output power for an No/2 input AWGN, when (only the magnitude response is

given)

1. A rectangular �lter with bandwidth B, |H(f)| = Horect(f/2B)
2. A sinc �lter with �rst null at f = B, |H(f)| = Hosinc(f/B)
3. A Manchester pulse matched-�lter, where h(t) = rect((t−T/4)/(T/2))−rect((t−3T/4)/(T/2))
4. An exponential �lter with h(t) = Aexp(−t/τ), t > 0.
5. The n-th order Butterworth Filter with frequency response

|H(f)|2 =
1

1 + (2πf)2n

These are all calculations you can do with basic calculus, or by Fourier transform. The Butter-

worth �lter response must be plotted and you can compute the noise gain.

Problem 2

A pulse matched �lter is often used in signal processing. To examine the output of the MF, to

input pulse s(t), we can either (1) compute the �lter response or (2) compute the auto-correlation
function. For example, for discrete time pulse s, the MATLAB command would be

b = conj(s([end:-1:1])); y = filter( b, 1, s); plot(y); grid

y = xcorr( s, s); plot(y);grid

Compute and display plot these for signals. Comment on the di�erences between the input

signal and the output of xcorr.

1. A rectangular �lter with bandwidth B, |H(f)| = Horect(f/2B)
2. A sinc �lter with null-to-null bandwidth B, |H(f)| = Hosinc(f/B)
3. A Manchester pulse matched-�lter, where h(t) = rect((t−T/4)/(T/2))−rect((t−3T/4)/(T/2))
4. A rect pulse coded Barker-13 pulse,

s(t) =
N=13∑
k=1

bkp(t−kT), p(t) = rect(t−T/2)/T

The bk is the Barker-13 code, see Wikipedia:

https://en.wikipedia.org/wiki/Barker_code

Note this is di�erent from the plots shown in class, because we have added the rect signal. This is

the analog baseband signal that would be transmitted. Other pulse shapes can be used – the root

raised cosine.

Problem 3 Matched Filtering and Timing

3

Use Matlab (or other ) to generate the following signals at sampling rate Fs = 1/Ts, Ts = T/50.
(1MHz). This is called oversampling relative to the baud rate. Using the p(t) = sinc(t/T) pulse,
write a program to implement the matched �lter.Be sure to use both sides of the sinc. Plot the

resulting matched �lter output and show that the MF works as expected. To show that be sure you

can predict where the MF peak will occur.

You can implement a matched �lter in several ways, for example, using filter.m or conv.m.

The di�erence is in the length of the output signal. Convolution always gives the full length, but

the �lter output is limited to the length of the input. See MATLAB help as needed. Sometimes

zero-padding is needed to see the full response.

You can use the T = 1e− 06 with the above. Vary the time o�sets to see the e�ect on moving
the MF peak. Pick a plot and submit it. Label all axes. Explain any scaling you use. The scaling

depends on the oversampling rate, here 50x

Problem 4. Matched Filtering to a known pulse

Matched Filter theory tells us that the best (maximum SNR) linear receiver to the observation

y(t) = As(t) + w(t)

is the �lter

hMF (t) = s(T − t)

Here we are taking the pulse s(t) to be non-zero only on [0,T]. Sketch the MF response to the pules
1.

s(t) = rect(
t−T/2
T

)

2.

s(t) = rect(
t−T/4
T/2

)− rect(
t−3T/4
T/2

)

Recall the exact de�nition of rect(x) = 1, only when |x| < 1/2; otherwise 0. I strongly advising
sketching these analog pulse shapes. The convolutions can be done graphically and it is known that

the convolution of 2 rectangles is a triangle. The issue is (1) where are the triangles located, and
(2) what are their horizontal widths and vertical heights.

Determine SNR at the optimal sampling time for each of these signal. Assume the noise is

WGN of spectral level No/2.

Looking for this or a Similar Assignment? Click below to Place your Order