please fix the error for Index exceeds matrix dimensions.

3 views (last 30 days)
% Parameters
M = 16; % QAM modulation order
k = log2(M); % Number of bits per symbol
% UFMC system parameters
N = 128; % Number of subcarriers
L = 4; % Number of subcarriers per data block
alpha = 0.5:0.1:1.5; % Roll-off factor range
EbNo = 10; % Energy per bit to noise power spectral density ratio (dB)
% Generate random bits
numBits = N * k; % Total number of bits
data = randi([0 1], numBits, 1); % Random binary data
% Preallocate BER arrays
berKaiser = zeros(size(alpha));
berDolphChebyshev = zeros(size(alpha));
% Perform BER simulation for different roll-off factors
for i = 1:length(alpha)
% QAM modulation
qamData = qammod(data, M);
% UFMC modulation with Kaiser filter
ufmcDataKaiser = ufmcKyModulation(qamData, N, L, alpha(i), 'kaiser');
% UFMC modulation with Dolph-Chebyshev filter
ufmcDataDolphChebyshev = ufmcchModulation(qamData, N, L, alpha(i), 'dolphchebyshev');
% Add Rayleigh fading channel
h = (randn(128, length(ufmcDataKaiser)) + 1i * randn(128, length(ufmcDataKaiser))) / sqrt(2);
receivedSignalKaiser = ufmcDataKaiser .* h;
receivedSignalDolphChebyshev = ufmcDataDolphChebyshev .* h;
% AWGN channel
snr = EbNo + 10 * log10(k); % Convert EbNo to SNR
receivedSignalKaiser = awgn(receivedSignalKaiser, snr, 'measured');
receivedSignalDolphChebyshev = awgn(receivedSignalDolphChebyshev, snr, 'measured');
% UFMC demodulation
demodulatedDataKaiser = ufmcKyDemodulation(receivedSignalKaiser, N, L, alpha(i), 'kaiser');
demodulatedDataDolphChebyshev = ufmcchDemodulation(receivedSignalDolphChebyshev, N, L, alpha(i), 'dolphchebyshev');
% QAM demodulation
receivedBitsKaiser = qamdemod(demodulatedDataKaiser, M);
receivedBitsDolphChebyshev = qamdemod(demodulatedDataDolphChebyshev, M);
% Calculate BER
berKaiser(i) = biterr(data, receivedBitsKaiser) / numBits;
berDolphChebyshev(i) = biterr(data, receivedBitsDolphChebyshev) / numBits;
end
Unrecognized function or variable 'ufmcKyModulation'.
% Plot BER results
figure;
semilogy(alpha, berKaiser, 'b-o', 'LineWidth', 1.5);
hold on;
semilogy(alpha, berDolphChebyshev, 'r-s', 'LineWidth', 1.5);
grid on;
xlabel('Roll-off Factor (\alpha)');
ylabel('Bit Error Rate (BER)');
title('BER Performance Comparison: Kaiser vs. Dolph-Chebyshev Filter (Rayleigh Fading Channel)');
legend('Kaiser Filter', 'Dolph-Chebyshev Filter');
  2 Comments
Image Analyst
Image Analyst on 8 May 2024
Looks like the error is actually "Unrecognized function or variable 'ufmcKyModulation'" If you get a different error, then give it -- ALL THE RED TEXT. Make sure the value for the index on the right side of the equal sign is not bigger than the array.
Umeshraja
Umeshraja on 22 Nov 2024
Hi @Teshome, Attach the helper functions such as 'ufmcKyModulation' and 'ufmcKyDemodulation' to debug further

Sign in to comment.

Answers (0)

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!