How do I plot a function that has been split into multiple time intervals

1 回表示 (過去 30 日間)
Alex Bristol
Alex Bristol 2020 年 9 月 3 日
回答済み: Rafael Hernandez-Walls 2020 年 9 月 3 日
I need to plot a function but am not sure how to break it into multiple intervals. For example: 1 for -1<t<3 and 2t for 3<=t<6.
I also need to plot two different functions on the same graph and need help getting them both on the same graph

回答 (1 件)

Rafael Hernandez-Walls
Rafael Hernandez-Walls 2020 年 9 月 3 日
I don't know if I understand your problem, but I think it is related to the way to program the following code:
t=-1:0.1:6;
y=(t<=3).*sin(t)+(t>3).*cos(t);
y(t==3)=NaN;
plot(t,y)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by