where is the wrong this code!
10 views (last 30 days)
Show older comments
where is the wrong in this code.i can't run this code
clear; clc;
% Modulation schemes to compare
modulations = {'BPSK', 'QPSK', '8-PSK', '16-QAM', '64-QAM'};
% Transmit power and data rate
P_t = 0.1; % W
R = 100e6; % bps
% Extinction coefficient
c = 0.15; % m^-1
% PIN PD parameters
eta = 0.82;
fc = 300e6; % Hz
% Rx parameters
d = 0.2; % m
f = 0.25; % m
fov = 0.69;
% BER calculation
for i = 1:length(modulations)
modulation = modulations{i};
% Assume ideal receiver for simplicity
[~, ber(i)] = berawgn(modulation, R, P_t);
end
% Plot BER results
semilogy(1:length(modulations), ber, '-o');
xlabel('Modulation');
ylabel('BER');
xticks(1:length(modulations));
xticklabels(modulations);
grid on;
0 Comments
Answers (1)
Cris LaPierre
on 30 Jan 2023
The first input to berawgn must be a scalar or vector. Your first input is a character vector that seems to what is expected as the second input (modtype).
The first input argument, EbNo, is the ratio of bit energy to noise power spectral density in dB (Eb/N0).
Consult the documentation to be sure you are supplying the inputs the function expects.
0 Comments
See Also
Categories
Find more on BPSK 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!