# Matlab : How to plot the constellation diagram for this method?

I am trying to generate symbols +1,-1 using a function by partitioning the interval of the function into two levels. The function is the Tent Map. This in a way achieves bpsk modulation. I want to see the constellation diagram for bpsk . But I am getting error

Undefined variable "comm" or class "comm.RaisedCosineTransmitFilter".

Error in GenerateData (line 32)
txfilter = comm.RaisedCosineTransmitFilter('Shape','Normal', ...


So, I typed in >>

help comm.RaisedCosineTransmitFilter


and I believe that my Matlab does not have this class because this is the output of the help

comm.RaisedCosineTransmitFilter not found.

How can I view the constellation diagram?

This is the way I generate +1/-1 symbols for bpsk.

%generate bpsk
N = 10000; %number of data points
x(1) = rand(1,1);
for i =2:N
x(i) = 2 * min(x(i-1), 1 - x(i-1)); %Tent map implementation
end
modData = 2*(x>0.5)-1;  %generating symbols
% modData holds the modulated symbols
qpsk = comm.QPSKModulator;
Rup = 16;
txfilter = comm.RaisedCosineTransmitFilter('Shape','Normal', ...
'RolloffFactor',0.5, ...
'FilterSpanInSymbols',10, ...
'OutputSamplesPerSymbol',Rup);
constDiagram = comm.ConstellationDiagram('SamplesPerSymbol',Rup, ...
'SymbolsToDisplaySource','Property','SymbolsToDisplay',100);

txSig = txfilter( modData);
constDiagram(txSig)


Could somebody please show the correct way to obtain the constellation diagram. I am using Matlab2011b version on 64 bit i7 processor. Thank you.

• So, if your symbols are +1 and -1, why not just do plot([-1 1],[0 0],'x')? – MBaz Nov 29 '16 at 3:10
• Note the 'x' in my plot command. You really need to read the entire docs for plot. In general, you can do something like plot(real(C),imag(C),'x') where C is a complex array holding your constellation points. – MBaz Nov 29 '16 at 13:39

The function you are using is from the Communication Systems Design Toolbox. You might have it not installed/licensed on your PC.

In case you just want to plot a constellation diagram, you can go with this code (Note, that it works for QAM constellations, not BPSK (since BPSK has only one domain)).

values = -7:2:7;  % Values in real and complex domain
[X, Y] = meshgrid(values, values);
QAM = X(:) + 1j*Y(:);
plot(QAM, 'x')


Actually, the QAM constellation contains all combinations of possible real and complex values. Hence, you need the cartesian product between real and complex parts. Taking this solution, you can plot the constellation diagram.

• Well, your code above creates the same constellation diagram. Then, what's the problem? – Maximilian Matthé Nov 29 '16 at 19:09