write a matlab code to compute golomb sequence
4 次查看(过去 30 天)
显示 更早的评论
Is there any function for golomb sequence in matlab?. write the code to display the golomb sequence [the numbers ].
0 个评论
采纳的回答
更多回答(2 个)
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
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!