필터 지우기
필터 지우기

how to concatinate fibonacci sequence

조회 수: 1 (최근 30일)
sadiqa ilyas
sadiqa ilyas 2019년 8월 10일
댓글: sadiqa ilyas 2019년 8월 10일
Hi I want to write matlab code for fibonacci wordswhichis like
s(0)=0, s(1)=01, s(2)=010, s(3)=01001....
using formula s(n)=s(n-1)s(n-2). I have written a code but it gives error
clear all
n(1)=0;
n(2)=01;
k=3;
while k<=13
n(k)=horzcat(n(k-1),n(k-2));
k=k+1;
end
n(k)
error is
In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in fibbword (line 6)
n(k)=horzcat(n(k-1),n(k-2));

채택된 답변

Walter Roberson
Walter Roberson 2019년 8월 10일
n{1} = '0' ;
n{2} = '01';
k=3;
while k<=13
n{k} = horzcat(n{k-1},n{k-2});
k=k+1;
end
n{end}
  댓글 수: 4
sadiqa ilyas
sadiqa ilyas 2019년 8월 10일
and restrict to only 256 bits
sadiqa ilyas
sadiqa ilyas 2019년 8월 10일
Thanks a lot

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by