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!