Plotting two linear equations
13 ビュー (過去 30 日間)
古いコメントを表示
Hi. How can i plot this equation between (-5,2) values
f(x) =
- -1 ----> x<-1
- x^2+x ------> -1 <= x < 2
0 件のコメント
採用された回答
Star Strider
2018 年 3 月 16 日
Use ‘logical indexing’:
x = linspace(-5,2);
f = @(x) (-1).*(x < -1) + (x.^2 + x).*((x >= -1) & (x < 2));
figure(1)
plot(x, f(x))
grid
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!