How to plot this stepfunction
4 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I am trying to plot a step function can be seen below. Any help will be highly appreciated. Thank you.

0 件のコメント
回答 (1 件)
Star Strider
2018 年 9 月 23 日
For the unit step function, you can use the Symbolic Math Toolbox heaviside function, or this anonymous function:
ustp = @(t) +(t>0); % Simple Unit Step Function
I leave the rest to you.
Remember to use element-wise operations for the multiplications. See the documentation page on Array vs. Matrix Operations (link) and Vectorization (link).
4 件のコメント
Star Strider
2018 年 9 月 23 日
My pleasure.
My code is intended to illustrate how to combine the unit step function (my ‘ustp’ anonymous function) with another function to create the desired result. You cannot simply use it without modifying your code.
Also, you have to copy my ‘ustp’ function to the beginning of your script file. My code should then work.
参考
カテゴリ
Help Center および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!