format y axis on a graph

1 visualización (últimos 30 días)
lowcalorie
lowcalorie el 25 de Mzo. de 2012
here is my code i need to format the y axis to go from 0 to 1 with increments of 0.1 im not sure how to go about doing this
x = linspace(0,2*pi);
y1 = sin(x);
y2 = abs(sin(2*x))/2;
plot(x,y1,x,y2)

Respuesta aceptada

Wayne King
Wayne King el 25 de Mzo. de 2012
x = linspace(0,2*pi);
y1 = sin(x);
y2 = abs(sin(2*x))/2;
plot(x,y1,x,y2)
set(gca,'ylim',[0 1]);
set(gca,'ytick',0:0.1:1);
But you're going to cut off your y1 because that assumes values less than 0.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D 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