how to plot binary input
조회 수: 3 (최근 30일)
이전 댓글 표시
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
채택된 답변
Guillaume
2016년 3월 9일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!