how do i plot til some x one function and then other

1 visualización (últimos 30 días)
ABHISHEK N N
ABHISHEK N N el 22 de Oct. de 2020
Comentada: ABHISHEK N N el 22 de Oct. de 2020
i want to plot plz help
y = { x x<=12
12 x>12 }

Respuesta aceptada

Stephen23
Stephen23 el 22 de Oct. de 2020
Editada: Stephen23 el 22 de Oct. de 2020
x = 0:0.1:20;
y = min(12,x);
plot(x,y,'-+')
In a more general case, use logical indexing, e.g.:
x = 0:0.1:20;
y = x;
y(y>12) = 12;

Más respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by