How to adjust axes created using plot
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have a function that I have plotted on an interval of [-10,10] but I am not sure what the function is that will adjust the axes so there is empty space around the top of the function plot. Here is what I have to plot the function.
g = @(x) sin(x)/x
fplot(g, [-10, 10])
title('The result of fplot')
0 comentarios
Respuestas (1)
Jon
el 18 de Nov. de 2021
Editada: Jon
el 18 de Nov. de 2021
use the ylim command
for example
g = @(x) sin(x)/x
fplot(g, [-10, 10])
title('The result of fplot')
ylim([-2,2])
3 comentarios
Jon
el 19 de Nov. de 2021
You can set the limits of the y axis wherever you want. The argument to the ylim function is a two element vector. The first element sets the lower y limit of the plot, the second element sets the upper limit. They don't need to be symmetrical. So if you want just a little space below the plot and more above you could use:
g = @(x) sin(x)./x
fplot(g, [-10, 10])
title('The result of fplot')
ylim([-0.25,1.25])
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!