Plotting a function with three regions
Mostra commenti meno recenti
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 Commento
Use "piecewise" or define
g = @(n) -3*(n>=-4 & n <=2) + 2*(n>=3 & n<=5)
Risposte (1)
Walter Roberson
il 1 Mag 2023
0 voti
See https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html for information on how to use Logical Indexing
Categorie
Scopri di più su 2-D and 3-D Plots in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!