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!