MATLAB: How to use matlab comm.BPSKModulator system object

bpskcommunication

I am trying to simulate the following codes:
data = randi([0 1],100,1);
bpskModulator = comm.BPSKModulator;
bpskModulator.PhaseOffset = pi/16;
modData = bpskModulator(data);
scatterplot(modData)
but I am getting this error: Array formation and parentheses-style indexing with objects of class 'comm.BPSKModulator' is not allowed. Use objects of class 'comm.BPSKModulator' only as scalars or use a cell array.
Error in testerr (line 4) modData = bpskModulator(data);
Can someone help me please?

Best Answer

You are trying to use a syntax that is new in R2016b with an older MATLAB release. Use
modData = step(bpskModulator, data);
Related Question