1. Engineering
  2. Mechanical Engineering
  3. problem matlab review the goal of this problem is...

Question: problem matlab review the goal of this problem is...

Question details

Problem : MATLAB Review

The goal of this problem is to write a function, step_current, that returns a current with amplitude

  1. given time (t). The function should operate for 4 different input parameter settings:
    1. I = step_current(t)

Given no amplitude parameters, the function should return a current following the unit step function u(t). That is,

  1. I = step_current(t, t_step)

0,       < 0

𝐼() = {0.5,          = 0 }

1,       > 0

Again, no amplitude is provided. If t_step is a scalar, I should follow the function u(t-t_step). That is,

0,       <

𝐼() = {0.5,          = 𝑒𝑝 }

1,       >

If t_step is a vector {tk}, return a 0 if t < t1, a 1 if t1 < t < t2, a 0 if t2 < t < t3, etc… Return 0.5 if t = tk.

  1. I = step_current(t, t_step, I_step)

Where I_step is a scalar. This is the same as the previous case, but scaled by I_step. That is, the amplitude of the current should be I_step rather than 1.

  1. I = step_current(t, t_step, I_step)

Where I_step is a vector, {Ik}. In this case, I should be 0 when I is less than the first value of t_step. When t1 < t < t2, return I1, if t2 < t < t3, return I2, etc…

You should also find a way to handle cases when length(I_step) does not equal length(t_step). If length(I_step) > length(t_step), ignore elements of I_step greater than length(t_step). If length(I_step) < length(t_step), extend the I_step matrix with [0, Iend, 0, Iend] until length(I_step)

= length(t_step).

Test function with the following input parameters and plot the results in 2 figures with 4 subplots each. Title and label appropriately.

Figure (1)

Figure (2)

a.   t = linspace(-1,9,101);

e. t = linspace(-1,9,101); t_step = [1.3 2.8 3 4.1 6 8]

I_step = 1.4

b. t = linspace(-1,9,101); t_step = 2.5

f.    t = linspace(-1,9,101); t_step = [1.3 2.8 3 4.1 6 8]

I_step = [1 0 -1 3 0 2]

c. t = linspace(-1,9,101); t_step = [1.3 2.8 4.1 6 8]

g. t = linspace(-1,9,101); t_step = [1.3 2.8 3 4.1 6 8]

I_step = [1 0 -1 3 0 2 0 4 5]

d. t = linspace(-1,9,101); t_step = 2.5

I_step = 1.4

h. t = linspace(-1,9,101); t_step = [1.3 2.8 3 4.1 6 8]

I_step = [-1 0 3]

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution