When using integral function to calculate MeijerG function, Matlab will get stuck.
4 views (last 30 days)
Show older comments
When using integral function to calculate MeijerG function, Matlab will get stuck.
Does anyone have same problem?
How can I figure that?
alpha_value = 4.399688384728341;
beta_value = 2.571722827839187;
g_value = 0.749154464911330;
A0 = 0.1172;
hl = 0.9033;
Pt = 3.1632;
Energy_Efficiency = 0.5;
h_rain = 1;
N0 = 1.0e-07;
function pdf = pdf_of_ht(ht, alpha_value, beta_value, g_value, A0, hl)
pdf = alpha_value * beta_value * (g_value^2) / (A0 * hl) / ...
(gamma(alpha_value) * gamma(beta_value)) * ...
meijerG([], [g_value^2], [g_value^2 -1], [alpha_value - 1, beta_value - 1], (alpha_value * beta_value * ht) / (A0 * hl));
end
function pdf = pdf_of_SNR(SNR, alpha_value, beta_value, g_value, A0, hl, Pt, Energy_Efficiency, h_rain, N0)
h_to_SNR = 2 * Pt^2 * Energy_Efficiency^2 * h_rain^2 / N0^2;
ht = sqrt(SNR ./ h_to_SNR);
pdf = pdf_of_ht(ht, alpha_value, beta_value, g_value, A0, hl) .* (1 ./ (2 .* sqrt(SNR * h_to_SNR)));
end
function ber = ber_func(x)
ber = 0.5 * erfc(sqrt(x) / sqrt(2));
end
% Get stuck on the following line
average_ber = integral(@(SNR) ber_func(SNR) .* pdf_of_SNR(SNR, alpha_value, beta_value, g_value, A0, hl, Pt, Energy_Efficiency, h_rain, N0), 0, Inf, 'RelTol',1e-3, 'AbsTol',1e-6);
Thanks a lot
0 Comments
Accepted Answer
Torsten
on 8 Apr 2024
meijerG has a division by 0 at SNR = 0. If you are sure the integral exists at SNR = 0, start with a small value > 0, e.g.
average_ber = integral(@(SNR) ber_func(SNR) .* pdf_of_SNR(SNR, alpha_value, beta_value, g_value, A0, hl, Pt, Energy_Efficiency, h_rain, N0), 1e-8, Inf)
0 Comments
More Answers (0)
See Also
Categories
Find more on Propagation and Channel Models 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!