How do you plot a signal that has been broken up into time brackets?

1 回表示 (過去 30 日間)
Jared Joselowitz
Jared Joselowitz 2020 年 8 月 26 日
回答済み: Kiran Felix Robert 2020 年 8 月 28 日
I have got this signal that has a different defintion for certain time parameters. How do I plot the signal m(t) on one graph?

採用された回答

Kiran Felix Robert
Kiran Felix Robert 2020 年 8 月 28 日
Hi Jared,
This can be done using the logical indexing as shown below,
t = -1:0.01:5;
m = zeros(1,length(t));
idx = (t>=0) & (t<1);
m(idx) = t(idx);
idx = (t>=1) & (t<2);
m(idx) = 2 - t(idx);
plot(t,m)
Kiran Felix Robert

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by