When using integral function to calculate MeijerG function, Matlab will get stuck.

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

 채택된 답변

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개)

카테고리

도움말 센터File Exchange에서 MATLAB Coder에 대해 자세히 알아보기

제품

릴리스

R2024a

질문:

2024년 4월 8일

답변:

2024년 4월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by