Error using comm.PSKModulator/step. Inputs must be either numeric or logical variables or fi objects.

1 view (last 30 days)
I'm getting above error while I'm trying to modulate a sequence of bits using PSK Modulation in Matlab. Below is the code snippet for the same which is giving me the error.
levels = 4; input_signal = rand(48,1); % generating a sequence of 48 random numbers between [0,1] % partition= [0.25,0.5,0.75,1.0]; codebook = [0,0.25,0.5,0.75,1.0]; [index,q] = quantiz(input_signal,partition,codebook); % trying to quantize them to 4 levels % bin_data = zeros(log2(levels)); % converting above four levels to two bit binary% for i=1:length(q) ind = find(codebook==q(i))-1; if (i ==1) bin_data = dec2bin(ind,log2(levels)); else bin_data=horzcat(bin_data,dec2bin(ind,log2(levels))); end end output = transpose(bin_data); psk_modulator = comm.PSKModulator(16,'BitInput',true); psk_modulator.PhaseOffset = pi/16; modulated_data = step(psk_modulator, output)

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!