Making a piecewise linear plot

16 ビュー (過去 30 日間)
Carlos
Carlos 2013 年 10 月 28 日
編集済み: Ned Gulley 2013 年 10 月 28 日
I am trying to do a simple plot in matlab, how can I do this: a line that has a constant slope from y=0 to 40, then at 40 it is a flat line until infinity. I am still rusty with matlab and I am not sure how to do this. this slope goes from x=0 to 32

回答 (1 件)

Jamie
Jamie 2013 年 10 月 28 日
編集済み: Jamie 2013 年 10 月 28 日
Hi Carlos,
Many way to do this. For a piecewise cont func try this
t=[0:0.1:32];
y = 40/32*t;
plot(t,y)
hold on
t1 = [32:0.1:100];
y1 = 40*ones(size(t1));
plot(t1,y1)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by