필터 지우기
필터 지우기

write a matlab code to compute golomb sequence

조회 수: 4 (최근 30일)
Olumide David  Awe
Olumide David Awe 2015년 2월 11일
답변: pallarlamudi bharadwaj 2017년 2월 9일
Is there any function for golomb sequence in matlab?. write the code to display the golomb sequence [the numbers ].

채택된 답변

daniel
daniel 2015년 2월 11일
편집: daniel 2015년 2월 11일
function [seq] = golombseq(n)
%n is defined by user
a = zeros(1,n);
a(1,1) = 1;
for ii = 1:n
a(1,ii+1) = 1+a(1,ii+1-a(a(ii)));
seq = a;
end
  댓글 수: 2
Olumide David  Awe
Olumide David Awe 2015년 2월 26일
Thanks,works perfectly. A quick question, did ii+1 iterates the number?
daniel
daniel 2015년 3월 4일
ii+1 iterates the 1xn sequence (vector) "a" column-wise ;)

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

추가 답변 (2개)

Aamod Garg
Aamod Garg 2017년 2월 7일
편집: Aamod Garg 2017년 2월 7일
function [seq] = golomb(n)
%n is defined by user
a = zeros(1,n);
a(1,1) = 1;
for j = 2:n
a(1,j) = 1+a(1,j-a(1,a(1,j-1)));
seq = a;
end

pallarlamudi bharadwaj
pallarlamudi bharadwaj 2017년 2월 9일
if true
% code
end

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by