Plot binary sequence of type char (MATLAB)
이전 댓글 표시
Dear,
I have this binary sequence '011010001000000001010011' of type char, and I want to plot it to obtain a graph like that for example:

댓글 수: 2
Fifteen12
2022년 12월 2일
What have you tried so far? Love to help, but not sure what you're confused on!
high speed
2022년 12월 2일
채택된 답변
추가 답변 (1개)
seq = randi(2, [1, 20]) - 1;
y = seq(1);
x = 0;
for i = 1:length(seq)-1
y(end+1) = seq(i);
x(end+1) = i;
if seq(i+1) ~= seq(i)
y(end+1) = seq(i+1);
x(end+1) = i;
end
end
plot(x, y)
axis([0, x(end), -2, 3])
카테고리
도움말 센터 및 File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

