Commit e1231e86 authored by Renaud Gonce's avatar Renaud Gonce

Add new file

parent e6940243
function [s] = pammod(N_symbols,M)
% Randomly produces a sequence of N_symbols symbols, using a PAM modulation
% with parameter M, giving the number of possible symbol values. M should
% be a power of 2 ; the number of bits per symbol is then given by log_2(M)
symbols_TX = (rand(N_symbols,1)-0.5)*M;
s = zeros(N_symbols,1);
for i = 1:N_symbols
if symbols_TX(i) == 0
s(i) = -1;
elseif symbols_TX(i) < 0
s(i) = floor(symbols_TX(i))*2+1;
elseif symbols_TX(i) > 0
s(i) = ceil(symbols_TX(i))*2-1;
end
end
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment