plotting eps function

1 visualización (últimos 30 días)
Derek
Derek el 14 de En. de 2012
Hi,
I am tasked with plotting Y=((1.0+x)-1.0)/x) vs. x on a semilog plot however the plot shows nothing but the axis. Ideally it should be at a value of Y=0 until the x-axis reaches eps(1), at which point there is a step function where Y=1. My code is as follows,
Y=((1.0+x)-1.0)/x;
x=0:eps(1)/10:2*eps(1);
semilogx(Y,x)
axis([0 2*eps(1) 0 1.5]);
Any help would be greatly appreciated.
Thanks!
Derek

Respuestas (1)

the cyclist
the cyclist el 14 de En. de 2012
When you applied the axis() function, you are restricting to a region that does not have your plotted points. I think maybe you meant to plot
>> semilogx(x,Y)
or else you need to switch the x and y values in your axis() command.

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