problem with stairs plot

Hello I have just delighted come across 'stairs', which does exactly what I want...except it doesn't.
Even the example given: >> x = linspace(-2*pi,2*pi,40); >> stairs(x,sin(x))
plots me a single straight line between (0,0) and (1,1). (Everything I try gives this plot result)
Any great ideas for the obvious thing I'm doing wrong very gratefully received!
yours, Flummoxed.

Respuestas (3)

Daniel Shub
Daniel Shub el 20 de Ag. de 2011

1 voto

Is something overloading stairs? Try
which -all stairs
it should give something like: .../toolbox/matlab/specgraph/stairs.m

2 comentarios

deborah
deborah el 20 de Ag. de 2011
thanks for your reply.
unfortunately it doesn't seem to be the fix (though, good thought!)....
indeed it says: C:\Program Files\MATLAB\R2007b\toolbox\matlab\specgraph\stairs.m
Fangjun Jiang
Fangjun Jiang el 20 de Ag. de 2011
What do you see if you do:
x = linspace(-2*pi,2*pi,40);
figure;plot(x,sin(x))

Iniciar sesión para comentar.

Fangjun Jiang
Fangjun Jiang el 20 de Ag. de 2011

0 votos

What's wrong? try stairs(1:20,1:20)

4 comentarios

deborah
deborah el 20 de Ag. de 2011
thanks for your reply.
What's wrong is that everything, inlcuding the example you gave, but also the sine wave example, give a straight line plot between (0,0) and (1,1)... I'm not sure how to be clearer...
deborah
deborah el 20 de Ag. de 2011
i mean a diagonal line!
Fangjun Jiang
Fangjun Jiang el 20 de Ag. de 2011
try this.
close all
stairs(1:20,1:20);
deborah
deborah el 20 de Ag. de 2011
same result! :(

Iniciar sesión para comentar.

deborah
deborah el 21 de Ag. de 2011

0 votos

I have no idea, but now after 3 reboots it suddenly works. That'll be fixed then..... thanks for people's suggestions.

Categorías

Más información sobre Labels and Styling en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 20 de Ag. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by