Question: D . 4 ( a ) Write a function called unitstep that takes a single real argument t and returns u ( t ) ,

D.4(a) Write a function called unitstep that takes a single real argument t and returns u(t), where
u(t)=(
1 t >=0
0 otherwise.
(b) Modify the function from part (a) so that it takes a single vector argument t =[t1 t2... tn ]
T
(where n >=1 and
t1,t2,...,tn are real) and returns the vector [ u(t1) u(t2)... u(tn)]
T
. Your solution must employ a looping construct
(e.g., a for loop).
(c) With some ingenuity, part (b) of this exercise can be solved using only two lines of code, without the need
for any looping construct. Find such a solution. [Hint: In MATLAB, to what value does an expression like
[-2-1012]>=0 evaluate?]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!