write a matlab code to compute golomb sequence
4 views (last 30 days)
Show older comments
Olumide David Awe
on 11 Feb 2015
Answered: pallarlamudi bharadwaj
on 9 Feb 2017
Is there any function for golomb sequence in matlab?. write the code to display the golomb sequence [the numbers ].
0 Comments
Accepted Answer
More Answers (2)
Aamod Garg
on 7 Feb 2017
Edited: Aamod Garg
on 7 Feb 2017
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
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!