how to plot binary input
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
kumud alok
am 9 Mär. 2016
Beantwortet: Guillaume
am 9 Mär. 2016
my data matrix has 19 rows and 396 columns.
row 1=[0 1 0 1......]
row 2=[1 0 1 1 1 0...]
.
.
row 19=[0 1 0 1 0 0..]
how should I code this using plot function in Matlab ? given below:
if(bit==0)
X axis= X++;
Y axis= Y++;
/*graph will show increment by 1 */
else
X axis = X++;
Y axis = Y--;
/* graph will show decrements by 1*/
for example: row 1=[0 0 1...] row 2=[1 0 1...] take row 1 first bit is 0 so point must plot on (1,1) next bit is 0 so point must plot on (2,2) next bit is 1 so plot on(3,1) and so on take row 2 first bit is 1 so plot on (1,-1) next bit is 0 so plot on (2,0) and so on basically 0 show increment by 1 and 1 shows decrements by 1 ... by plotting this type of graph ...it become easy for me to analyse similar pattern of bit strings ...and those bit strings shows similar pattern will be on one cluster..remember X axis is columns and Y axis is rows ..
0 Kommentare
Akzeptierte Antwort
Guillaume
am 9 Mär. 2016
bitstrings = [0 0 1 1 0 0 0;
0 1 0 1 0 0 1;
1 0 1 1 1 0 0;
0 1 0 1 0 0 0;] %for example
You need to transform your [0 1] in offsets [+1 -1], which is simply achieve by 1-2*bitstrings. cumsum that and you've got your y coordinates. simply plot that matrix and matlab will use 1:... for x exactly as you want. By default plot plots by columns, so transpose the matrix beforehand:
plot(cumsum(1-2*bitstrings'))
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Graphics Performance finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!