projects
/
4yp.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
7521befcdc4b64367b87349e566b5bc6f72e05f1
[4yp.git]
/
randomPSK.m
1
function x = randomPSK(n, len)
2
% symbols: nth roots of unity
3
% i.e. solutions to polynomial x^n - 1 = 0
4
symbols = roots([1 zeros(1, n-1) -1]);
5
6
x = zeros(1, len);
7
for i = 1:len
8
x(i) = randomChoice(symbols);
9
end
10
end
11
12
function x = randomChoice(arr)
13
i = randi(length(arr));
14
x = arr(i);
15
end