Azzera filtri
Azzera filtri

How to plot binary input ?

53 visualizzazioni (ultimi 30 giorni)
Nasser
Nasser il 24 Nov 2011
Risposto: salih il 2 Gen 2015
how to plot binary input using matlab?
for example; a = [ 1 0 0 0 1 1 0 1 0 1 0 1 0 1 ]

Risposta accettata

Rick Rosson
Rick Rosson il 25 Nov 2011
Please try:
figure;
stairs([a,a(end)]);
HTH.
  1 Commento
Nasser
Nasser il 25 Nov 2011
HTH : yeah, it does help .. thank you ;)

Accedi per commentare.

Più risposte (5)

Wayne King
Wayne King il 24 Nov 2011
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 il 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 il 24 Nov 2011
I mean the plotting should looks like : http://www.olson-technology.com/mr_fiber/images/digital.gif
  2 Commenti
Walter Roberson
Walter Roberson il 24 Nov 2011
http://www.mathworks.com/help/techdoc/ref/stairs.html
Nasser
Nasser il 25 Nov 2011
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]

Accedi per commentare.


Rick Rosson
Rick Rosson il 24 Nov 2011
figure;
stairs(a);
  1 Commento
Nasser
Nasser il 25 Nov 2011
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]

Accedi per commentare.


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

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by