Engineering elct

smiedr

  

For full credit:

Include question, matlab code used determine answer and your answer. Submit as pdf. 


1) Create a function called step_fn(t). 

This is also common to call this function u(t) or u_fn(t)

Input: time vector

Output: a vector of the same length with values of 0 if t<0, and 1 otherwise



2) Create a function called ramp_fn(t)

This is also common to call this function r(t), r_fn(t) or tu(t)

Input: time vector

Output: a vector of the same length with values of 0 if t<0, and t otherwise



3)  Create a function called g1_fn(t)

This function should be equal to step_fn(t) + ramp_fn(t) – ramp_fn(t-3) -3*step_fn(t-5)



4)  Plot the following functions (can put on one plot or use subplots -- decide how to best present the functions). 

u(t)

u(t-2)

2u(t)

-3u(t+2)



5) Plot the following functions (can put on one plot or use subplots -- decide how to best present the functions). 

r(t)

r(t-2)

2r(t)

-3r(t+2)



6) Plot the following functions (can put on one plot or use subplots -- decide how to best present the functions). 

sin(t)u(t)

sin(t)u(t-π)

sin(t-π)u(t-π)



7) Plot the following functions (can put on one plot or use subplots -- decide how to best present the functions). 

g(t)

g(t-2)

g(2t)

g(t/2)



8) Write a script to determine the balance in a saving account at the end of every year for n =  years.  The account has an initial investment of A$ and the interest rate is r, and compounds annually. Show the script should request 

Initial investment amount

Interest rate

years 

if should create a vector for number of year [1:n], and the balance after each year

Balance = A(1 + r/100)n

    • 7 years ago
    • 2
    Answer(0)