i am writing a code for unipolar RZ.Where '1' in the input is transformed to 1 and 0 over the same period of input.whereas 0 in the input remains as 0 throughout the period. The code goes like this
Ndata=8input = randint(1, 2*Ndata); % make polar signal
for j=1:length(input) if input(j)==1 output(j:(j/2))=1; output((j/2):((j/2)+1))=0; else output(j:(j/2))=0; output((j/2):((j/2)+1))=0; endend
it gives me an error showing that "Warning: Integer operands are required for colon operator when used as index "??? "Subscript indices must either be real positive integers or logicals".
Kindly resolve my problem. Thanks.
Best Answer