This is self-answering - I found the reason why the error rates are strange other than "modulation index" of 0.5. CPFSKDemodulator also requires to have the "modulation index" parameter like in CPFSKModulator, so that Modulator and Demodulator have the same "modulation index". In my original code, I set CPFSKModulator with "modulation index" but not in CPFSKDemodulator which causes the strange SNR curves other than the modulation index of 0.5. After fixing this, I got fairely reasonable plots.
CPFSK demodulator performance in MATLAB example with enabling modulation index
3 views (last 30 days)
Show older comments
I've been checking CPFSK performance against various modulation indices and SNR.
MATLAB has nice examples in comm.CPFSKModulator. Here is the example code with enabling "modulation index" property and few changes to creates the plot (Default "modulation index" is 0.5). From the result, I noticed that there are always high error rate with the "modulation index" other than 0.5 which doesn't seem CPFSK to be usable. Since I'm just copying the example code with modifying "modulation index" parameter, I'm wondering if this is real CPFSK performance or not.. Since different "modulation index" could be used, I have feeling that I made mistake in the code below but could not locate it. Or did I use the function incorrectly?
The attached plot shows error rates for different modulation indices and SNR and the code which generated the plot.
rng(1000);
M = 2; % In power of 2
h = [0.25 0.5 0.75 1.0];
snr = (-10:1:20);
Len_h = length(h);
Len_snr = length(snr);
ser = zeros(Len_h, Len_snr);
for ind_h = 1:Len_h
cpfskMod = comm.CPFSKModulator(...
M, ...
BitInput=true, ...
SymbolMapping="Binary", ...
ModulationIndex=h(ind_h));
for ind_snr = 1:Len_snr
awgnChan = comm.AWGNChannel( ...
NoiseMethod="Signal to noise ratio (SNR)", ...
SNR = snr(ind_snr));
cpfskDemod = comm.CPFSKDemodulator(...
M, ...
BitOutput=true, ...
SymbolMapping="Binary");
numFrames = 1000;
k = log2(M);
spf = 100;
delay = log2(M)*cpfskDemod.TracebackDepth;
errorRate = comm.ErrorRate(...
ReceiveDelay=delay);
for counter = 1:numFrames
data = randi([0 1], k*spf, 1);
modSignal = cpfskMod(data);
noisySignal = awgnChan(modSignal);
receivedData = cpfskDemod(noisySignal);
errorStats = errorRate(data, receivedData);
end
ser(ind_h, ind_snr) = errorStats(1);
end
end
for i=1:Len_h
semilogy(snr, ser(i, :), 'LineWidth',2);
hold on;
end
legend('h=0.25', 'h=0.5', 'h=0.75', 'h=1.0');
xlabel('SNR');
ylabel('Symbol Error Rate');
hold off;
grid on;
0 Comments
Accepted Answer
Jay
on 11 Oct 2023
2 Comments
Fatima Ismail
on 6 Dec 2023
I'm Working on CPFSK modulation and demodulation and stuck at many points in my code? Where can I find help for it
More Answers (0)
See Also
Categories
Find more on Modulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!