Plotting a function with three regions
古いコメントを表示
Hi,I have been plotting various functions on matlab but I can’t wrap my head around this one, how can I write or plot this function when it has three values in three regions?

1 件のコメント
Use "piecewise" or define
g = @(n) -3*(n>=-4 & n <=2) + 2*(n>=3 & n<=5)
回答 (1 件)
Walter Roberson
2023 年 5 月 1 日
0 投票
See https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html for information on how to use Logical Indexing
カテゴリ
ヘルプ センター および File Exchange で 2-D and 3-D Plots についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!