Solution 3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Homework#3, Ve216 Summer 2023 Due 11:40 am June 13

Homework 3

Answers:
1. [5] T1 = 23 , T2 = 12 , T = lcm(T1 , T2 ) = 2, !0 = ⇡

1 j(3)⇡t 1
x(t) = sin(3⇡t) + cos(4⇡t) = (e ej( 3)⇡t
) + (ej(4)⇡t + ej( 4)⇡t
)
2j 2
By inspection, we have
81
>
> 2 , k = ±4
>
<1
2j ,k = 3
ak = 1
>
> ,k = 3
>
: 2j
0 , otherwise

2. [9]
(a) It is an impulse train with a period of T = 4
Z T /2
1 jk 2⇡ 1
ak = x(t)e T t =
T T /2 4

We can find that ak is a constant.


1
X 1
1 jk!0 t 1 X1 ⇡
x(t) = e = + cos(k t)
4 4 2 2
k= 1 k=1

(b) Sketch x(t) and we find it can be expressed as


1
X 1
x(t) = 1 + rect(t 5n )
n= 1
2

x(t) = 1 +
1
X 1 k
sinc( )ejk(2⇡/5)(1/2) ejk(2⇡/5)t
DE ?
5 5
k= 1

6 X1
x(t) = +
1
k o
sinc( ) cos(
2⇡(t 1/2)k
)
5 5 5 5
k=1

(c) For this signal T = 2, !0 = ⇡


Z 1
1
ak = e te jk!0 t
dt
2 0
Z 1
1 (1+jk⇡)t
ak = e dt
2 0

1 e (1+jk⇡)
ak =
2(1 + jk⇡)
1 1
X
1 e 1 e 1 cos(k⇡) k⇡(1 e 1 cos(k⇡))
x(t) = + [ 2 2
cos(k⇡t) + sin(k⇡t)]
2 1+k ⇡ 1 + k2 ⇡2
k=1

3. [9]
(a) If x(t) is real. Then x(t) = x(t)⇤ , which implies that ak = a⇤ k . It is not true in this case, so x(t) is
not real.
(b) If x(t) is even, then x(t) = x( t) and ak = a k. It is true in this case, so x(t) is even.

1
Homework#3, Ve216 Spring 2023 Due 11:40 am Mar. 21

(c) We have
dx(t) FS 2⇡
g(t) = ! bk = jk ak
dt T0
Therefore, 8
<0 ,k = 0
bk = 1 2⇡
: k( )|k| , otherwise
2 T0
dx(t)
Since bk is not even, is not even.
xt
4. [10]
(a) A sample code is shown below,
a0 = 0.25;
t= -15: 0.01: 15;
x = 0*t;
x = x + a0;
for k=1:5000
x = x+0.5.*cos(pi.*k.*t./2);
end
plot(t,x)
The result,

Figure 1: Results for (a)

(b) A sample code is shown below,


a0 = 1.2;
t= -15: 0.01: 15;
x = 0*t;
x = x + a0;
for k=1:50000
x = x+0.4.*sinc(k./5)*cos(2.*pi.*k.*(t-0.5)./5);
end
plot(t,x)
ylim([-1 3])
grid on

2
Homework#3, Ve216 Spring 2023 Due 11:40 am Mar. 21

And the result is like this,

Figure 2: Results for (b)

(c) You may also have a look at the third one.

Figure 3: Results for (c)

5. [8]
(a) Sample code for N = 19 is as follows:
clc
close all
a0 = 0.5 * (1 - exp(-1));
t = linspace(-0.5, 4.5, 1000);
x = zeros(1, 1000);

3
Homework#3, Ve216 Spring 2023 Due 11:40 am Mar. 21

x = x + a0;
x0 = a0;
x1 = a0;
for k = 1:19
b = (1 - exp(-1)*(-1)^k)/(1 + k^2*pi^2);
c = b * k * pi;
x = x + b * cos(pi * k .* t) + c * sin(pi * k .* t);
x0 = x0 + b * cos(pi * k .* 0) + c * sin(pi * k .* 0);
x1 = x1 + b * cos(pi * k .* 1) + c * sin(pi * k .* 1);
end
fprintf(’When k = %d, x(0) = %f, x(1) = %f\n’, k, x0, x1);
plot(t,x);
xlabel(’t’), ylabel(’x(t)’)
And the plot for N = 19 is given below (other values for N are omitted):

⑳ ·

Figure 4: HW3-8

One should be able to see that as N becomes larger, SN (t) becomes more like x(t). (One could also
talk about the Gibbs phenomena.)
(b) Using the code above, Matlab gives the following results:
When k = 5, x(0) = 0.482248, x(1) = 0.189060
When k = 10, x(0) = 0.490193, x(1) = 0.187942
When k = 15, x(0) = 0.493544, x(1) = 0.186133
When k = 19, x(0) = 0.494855, x(1) = 0.185718
1
In fact when N ! 1, SN (0) = 1/2 and SN (1) = e /2 .

6. [27]
2 2
(a) x(t) = LC d y(t) + RC dy(t) + y(t), so the di↵eq is given by d y(t) + dy(t) + y(t) = x(t) .
dt 2 dt d t2 dt
(b) The output of ej!t should be in the form H(j!)ej!t , where H(j!) have nothing to do with time t.
d2 j!t d 1
Hence dt2 (H(j!)e )+ dt (H(j!)ej!t )+H(j!)ej!t = ej!t . From which we have H(j!) = ! 2 +j!+1 .

4
Homework#3, Ve216 Spring 2023 Due 11:40 am Mar. 21

1
(c) H(s) = s2 +s+1 .
⇣ ⌘1/2
(d) |H(j!)| = (1 !21)2 +!2 . Use Matlab ezplot(’1/((1-x^ 2)^ 2 + x^ 2) ^ (1/2)’, [0 6])
to plot this function of !:

Figure 5: HW3-6d

(e) Sample code:


num = [1];
den = [1 1 1];
x = linspace(0, 6);
H = freqs(num, den, x);
plot(x, abs(H));
xlabel(’Angluar Freqs w (rad/s)’),
ylabel(’Magnitude Response |H(jw)|’),
title(’Hw6-3e’)
And the output figure:

5
Homework#3, Ve216 Spring 2023 Due 11:40 am Mar. 21

Figure 6: HW3-6e

We can see that the figure is identical to part (d), as expected.


1 jt jt 1 4jt 4jt
(f) T0 = 2⇡ and !0 = 1. And x(t) = 1 + 2j (e e )+ 2j (e e ) . Note that this already
implies c1 = c4 = 1/(2j), c 1 = c 4 = 1/(2j) and c0 = 1. After calculating the |ck |2 ’s, we use the
following code to generate a PDS:
x = [-4 -1 0 1 4];
y = [0.25 0.25 1 0.25 0.25];
stem(x,y,’filled’);
axis([-5 5 0 1.5]);
xlabel(’Angular frequncy \omega (k\omega_0)’),
ylabel(’Component power |c_k|^2’),
title(’Power Density Spectrum (Hw6-3f)’)

1
R
2⇡ P
(g) By using computer, we get 2⇡ |x(t)|2 = 2. And we have |ck |2 = 1 + 0.25 + 0.25 + 0.25 + 0.25 = 2.
0
Hence the Parseval’s relation is verified.
1 jt jt 1 1 jt 1
(h) y(t) = 1 ⇤ H(0) + 2j (H(1)e H( 1)e + H(4)ej4t H( 4)e j4t
) = 1+ 2j ( j e je
jt
+
1 j4t 1 j4t 4 15
15+j4 e 15 j4 e ) = 1 cos(t) 241 cos(4t) 241 sin(4t) . The code for PDS is very similar
to part (f), and the figure is shown below: (Note that the stem at ± 4 should have height 1/964.)

(i) The high frequency component (4 rad/s sine wave) is attenuated. The circuit serves as a lowpass
filter.

6
Homework#3, Ve216 Spring 2023 Due 11:40 am Mar. 21

Figure 7: HW3-6f

Figure 8: HW3-6h

7
Homework#3, Ve216 Spring 2023 Due 11:40 am Mar. 21

7. [10] We know that


1
X
y(t) = ak H(jk!0 )ejk!0 t ,
k= 1

where !0 = 12 from the question. This implies H(j!) must be zero for |!| > 100, so |k|!0 > 100. That
is, for |k| 9 , ak is guaranteed to be zero.

8. [10]

9. [12] The solution is as follows:

Optional Problems:
1. For any t0 , we have
Z t0 +T0
1 j!0 kt t0 +T0 1
ej!0 kt dt = e | t0 = (ej!0 k(t0 +T0 ) ej!0 kt0 )
t0 j!0 k j!0 k

1 j!0 kt0 jk2⇡


=)= e (e 1) = 0, k 6= 0
j!0 k

When k = 0, we have ej!0 k = 1 thus,


Z t0 +T0
ej!0 kt dt = T0
t0

From the above calculation, we can conclude that,


Z b Z t0 +T0

< k, l >= k (t) l (t)dt = ej!0 kt ej!0 lt
a t0

Z (
t0 +T0
T0 ,l = k
ej!0 (k l)t
dt =
t0 0 , l 6= k

2.
1
X
x(t) = a0 + (ak ejk!0 t + a ke
jk!0 t
)
k=1

1
X
x(t) = a0 + [(ak + a k ) cos(k!0 t) + (ak a k )j sin(k!0 t)]
k=1

8
Homework#3, Ve216 Spring 2023 Due 11:40 am Mar. 21

Z T
1
B[0] = a0 = x(t)dt
T 0

Z T Z T Z T
1 jk!0 t 1 jk!0 t 1 jk!0 t
B[k] = ak + a k = x(t)e + x(t)e = x(t)(e + ejk!0 t )dt
T 0 T 0 T 0

Z T
2
B[k] = x(t) cos(k!0 t)dt
T 0

For the same reason,


Z T
2
A[k] = (ak a k )j = x(t) sin(k!0 t)dt
T 0

3. (a) we have X
x(t) = ak ejk(2⇡/T )t
odd k

Therefore,

T X
x(t + )= ak ejk⇡ ejk(2⇡/T )t
2
odd k

Since ejk⇡ = 1 for odd k.

T
x(t + )= x(t)
2
(b) The Fourier series coefficients of x(t) are
Z T /2 Z T
1 jk!0 t 1 jk!0 t
ak = x(t)e dt + x(t)e dt
T 0 T T /2

9
Homework#3, Ve216 Spring 2023 Due 11:40 am Mar. 21

Z T /2
1 T jk⇡ j!0 t
ak = [x(t) + x(t + )e ]e dt
T 0 2
T
Note that ak evaluate to zero for even k if we have x(t) = x(t + 2 ). So it is odd harmonious.
4. (a) Take the derivative of x(t), we get x1 (t):

x1 (t)
x'lt
=rect +
1) + 8(t -

4
1

- 7
- -

I 0 2 4 6 8
&

t
0.5

Same as x(t), for x1 (t) T0 = 4 and !0 = ⇡/2. After some calculation we get the FS coefficients of
x1 (t):

a0 = 0, and ap =
↑ **
e-jkwotde
✓ k
◆ ↓
1 1 ( 1)

T-Erect(E) 4) jor
ak = 1+ (k 6= 0).
4 jk⇡ :
+ 5(t -

Using the di↵erentiating property, for all k 6= 0, we have


I
ak 2ak
bk = =
jk!0 jk⇡
(
1 0 (k even k 6= 0)
= + 1
2jk⇡ k2 ⇡ 2 (k odd),

1
R
where bk denotes the FS coefficients for x(t). And for b0 , we have b0 = 4 x(t)dt = 34 .

2j ⇡
(b) z(t) = 12 (z1 (t)+z2 (t)), where z1 (t) = x(t)e2j 2 t , and z2 (t) = x(t)e 2t . Let z1 (t) have FS coefficients
bk and z2 (t) have FS coefficients ck . Then
(
3
4 k=2
bk = a k 2 = 1 ( 1)k 1
2j⇡(k 2) + 2(k 2)2 ⇡ 2 k 6= 2,
(
3
4 k= 2
ck = ak+2 = 1 ( 1)k 1
2j⇡(k+2) + 2(k+2)2 ⇡ 2 k 6= 2,

and from linearity of FS, dk = 12 (bk + ck ) = (omitted).


3 1 3 13
And d2 = 8 + j16⇡ ,d 3 = j10⇡ 25⇡ 2 .

(c) From (a), we easily obtain

P
1
4
P
1
y(t) = 4x(t/3 2) + 5 = 8 + ⇡k sin k ⇡2 (t/3 2) 8
k2 ⇡ 2 cos k ⇡2 (t/3 2) .
k=1 k=1, odd

If you want to fully simplify this, it is equivalent as

P
1
8
P
1
4( 1)k
y(t) = 8 + k2 ⇡ 2 cos(k ⇡6 t) + ⇡k sin(k ⇡6 t).
k=1, odd k=1

5. The sample code and the three plots are given below:

10
Homework#3, Ve216 Spring 2023 Due 11:40 am Mar. 21

close all;
clear all;

[num, den] = besself(5,1e4);


f = linspace(0, 2e4, 1e5);
H = freqs(num, den, f);
figure, plot(f, abs(H));

[u, t] = gensig(’square’,0.002, 1, 1e-4);


figure, plot(t,u);
axis([0 0.01 -1 2]);

sys = tf(num, den);


y = lsim(sys, u, t);
figure, plot(t, y);
axis([0 0.01 -1 2]);

Figure 9: HW3-o5a

11
Homework#3, Ve216 Spring 2023 Due 11:40 am Mar. 21

Figure 10: HW3-o5b

Figure 11: HW3-o5c

12
Homework#3, Ve216 Spring 2023 Due 11:40 am Mar. 21

6. If the FS coefficients of x(t) are periodic with period N , then ak = ak N for all k. This implies that
x(t) = x(t)ej(2⇡/T )N t for all t. This is possible only if x(t) is zero for all t other than when (2⇡/T )N t = 2⇡k,
P1
where k 2 Z. Therefore, x(t) must be in the form x(t) = g[k] (t kT /N ). On the other hand,
k= 1
because x(t + N T /N ) = x(t + T ) = x(t) from the periodicity of x(t), we easily obtain g[k + N ] = g[k] for
all k.
7. The solution is as follows:

13

You might also like