How to plot binary input ?

how to plot binary input using matlab?
for example; a = [ 1 0 0 0 1 1 0 1 0 1 0 1 0 1 ]

 Accepted Answer

Please try:
figure;
stairs([a,a(end)]);
HTH.

1 Comment

HTH : yeah, it does help .. thank you ;)

Sign in to comment.

More Answers (5)

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 on 24 Nov 2011
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 on 24 Nov 2011

0 votes

I mean the plotting should looks like : http://www.olson-technology.com/mr_fiber/images/digital.gif

2 Comments

http://www.mathworks.com/help/techdoc/ref/stairs.html
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]

Sign in to comment.

figure;
stairs(a);

1 Comment

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]

Sign in to comment.

salih
salih on 2 Jan 2015

0 votes

how polt binary even and odd from for example {0 0 1 1 0 0 }

Tags

Asked:

on 24 Nov 2011

Answered:

on 2 Jan 2015

Community Treasure Hunt

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

Start Hunting!