How to plot binary input ?

94 次查看(过去 30 天)
Nasser
Nasser 2011-11-24
回答: salih 2015-1-2
how to plot binary input using matlab?
for example; a = [ 1 0 0 0 1 1 0 1 0 1 0 1 0 1 ]

采纳的回答

Rick Rosson
Rick Rosson 2011-11-25
Please try:
figure;
stairs([a,a(end)]);
HTH.

更多回答(5 个)

Wayne King
Wayne King 2011-11-24
a = [ 1 0 0 0 1 1 0 1 0 1 0 1 0 1 ];
stem(a,'markerfacecolor',[0 0 1]);
set(gca,'ylim',[-1.5 1.5])

Jan
Jan 2011-11-24
a = [ 1 0 0 0 1 1 0 1 0 1 0 1 0 1 ];
plot(a);
or perhaps:
plot(1:length(a), a, 'o');

Nasser
Nasser 2011-11-24
I mean the plotting should looks like : http://www.olson-technology.com/mr_fiber/images/digital.gif
  2 个评论
Walter Roberson
Walter Roberson 2011-11-24
http://www.mathworks.com/help/techdoc/ref/stairs.html
Nasser
Nasser 2011-11-25
that is what I was looking for.
but there is a problem, the last binary input always missing !!
I mean when the input is a = [ 1 0 1 ]
it only draw [1 0]

请先登录,再进行评论。


Rick Rosson
Rick Rosson 2011-11-24
figure;
stairs(a);
  1 个评论
Nasser
Nasser 2011-11-25
that is what I was looking for.
but there is a problem, the last binary input always missing !!
I mean when the input is a = [ 1 0 1 ]
it only draw [1 0]

请先登录,再进行评论。


salih
salih 2015-1-2
how polt binary even and odd from for example {0 0 1 1 0 0 }

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by