MATLAB Answers

Unit step function explanation

10 ビュー (過去 30 日間)
Smit Patel
Smit Patel 2019 年 11 月 30 日
Answered: Star Strider 2019 年 11 月 30 日
function u = u(t)
u=double(t>=0);
end
Question: Why is this the function for unit step? and what does double mean? I know that it gives the unit step function of constant 1 after 0 but I don't know why. Can anyone please help?
Thanks

  0 件のコメント

サインイン to comment.

採用された回答

Star Strider
Star Strider 2019 年 11 月 30 日
Use an anonymous function to shorten it even further:
u = @(t) t>0;
It works by using ‘logical indexing’, so that here, if ‘t’ is greater than 0, the logical comparison returns 1 for all values of ‘t’ greater than 0. When used in computations, the logical 1 becomes numerical 1, so the double function call is not necessary.

  0 件のコメント

サインイン to comment.

More Answers (1)

サインイン してこの質問に回答します。


Translated by