ECE 466 Homework 2

You can collaborate on homeworks and turn in a homework for 2 people.

Include your codes and answers within the cells that are requested. Do not create additional cells.

Double click on any cell to see the raw text that generates it. shift+enter runs a cell and shows you an output. Feel free to play with it but please return the question and description cells in the original format.

You can find markdown tutorials and guides by simple google search. Cheatsheets should be more useful if you are short on time.

Ask your questions in the discussion forums in D2L. You can post in homework or coding related. If it’s not specific to this homework

→

Coding Related.

Office hours T-Th 4-5 pm.

Upload the .ipynb document and a generated .html in a zip:

For html generation, you can google search. VSCode users: CTRL+SHIFT+P

→

type ‘html’

→

Jupyter: Export to HTML

I will import the necessary modules for you. Please only use these modules for now.

Your Name: [Name Surname]

import numpy as np

import matplotlib.pyplot as plt

from scipy import signal

1:

Figure of cascades of two systems

[12] Two discrete-time systems

T

1

and

T

2

are connected in cascade to form a new system

T

as shown in the figure above. Prove or disprove the following statements.

If

T

1

and

T

2

are linear, then

T

is linear (i.e., the cascade connection of two linear systems is linear).

If

T

1

and

T

2

are causal, then

T

is causal.

If

T

1

and

T

2

are stable, then

T

is stable.

If

T

1

and

T

2

are linear and time invariant, then interchanging their order does not change the system

T

.

Your answers for 1. should be written below in this cell.

2:

[12] The following input-output pairs have been observed during the operation of a linear system (An underline below a number means that that number is the signal value at

n

=

0

, e.g.

x

1

[

0

]

=

2

.):

x

1

[

n

]

=

{

−

1

,

2

–

,

1

}

T

→

y

1

[

n

]

=

{

1

,

2

–

,

−

1

,

0

,

1

}

x

2

[

n

]

=

{

1

,

−

1

–––

,

−

1

}

T

→

y

2

[

n

]

=

{

−

1

,

1

–

,

0

,

2

}

x

3

[

n

]

=

{

0

,

1

–

,

1

}

T

→

y

3

[

n

]

=

{

1

–

,

2

,

1

}

Is this system time invariant or not?

Your answers for 2. should be written below in this cell.

3:

[11] Determine and plot the convolution

y

[

n

]

of signals:

x

[

n

]

=

{

n

3

,

0

≤

n

≤

6

0

,

otherwise

h

[

n

]

=

{

1

,

−

2

≤

n

≤

2

0

,

otherwise

Label your axes correctly (Hint: Mind the

x

axis.).

# Your code for 3 should be written and executed in this cell.

4:

[25 points] Consider two banks. Bank #1 offers a 6\% annual interest rate, but charges a $1 service charge each year, including the year when the account was opened. Bank \#2 offers a 5\% annual interest rate, and has no annual service charge. Let

x

i

[

n

]

represent the amount of money you deposit in bank I during year

n

and

y

i

[

n

]

represent your balance in bank

i

. Assume that deposits during year

n

are credited to the balance in year n but earn no interest until year

n

+

1

.

Use difference equations to express the relation between deposits and balances for each bank.

Assume that you deposit $100 in each bank in the year 2022 and make no further deposits. Solve your difference equations in part a numerically to determine your balance in each bank during years 0 through 25. Make a plot of these balances. Which bank has the larger balance in the year 2026? Which bank has the larger balance in the year 2041?

Your answers for 4.1. should be written below in this cell.

# Your code for 4.2 should be written and executed in this cell.

5:

[25 points] Consider a system represented by a linear constant coefficient difference equation given by

y

[

n

]

+

1

4

y

[

n

−

1

]

−

1

8

y

[

n

−

2

]

=

x

[

n

]

+

x

[

n

−

1

]

, with initial conditions

y

[

−

1

]

=

4

,

y

[

−

2

]

=

−

2

and input signal

x

[

n

]

=

(

−

1

)

n

u

[

n

]

.

[10] Find the zero-input response and the zero-state responses.

[6] Find the total response. Comment on the forced response.

[6] What are the transient and steady-state responses in this case?

[8] Find the impulse response of this system and comment on its stability.

You can solve the question by paper and pen and embed an image in the markdown cell. Make sure that the image is legible in the output html.

Your answers for 5. should be written below in this cell.

6:

[15] Determine the impulse responses of the systems described by the following difference equations and comment on their stability:

y

[

n

]

=

0.6

y

[

n

−

1

]

−

0.08

y

[

n

−

2

]

+

x

[

n

]

.

y

[

n

]

+

9

16

y

[

n

−

2

]

=

x

[

n

−

1

]

.

y

[

n

]

−

0.7

y

[

n

−

1

]

+

0.1

y

[

n

−

2

]

=

2

x

[

n

]

−

x

[

n

−

2

]

.

Your answers for question 6. should be written below in this cell.