warning in solving MeijerG function on Matlab?

2 次查看(过去 30 天)
I'm trying to plot an equation contains meijerG function, i have an m.file for the meijerG function, when i run the code, i get a warning, it may be the reason why my plot has few errors, but i do not inderstand the warning, so anyone can just help me to know what is the warning wbout to fix it?
Here is the code:
a=0;
k_0=.1;
step = 0.1; range = 0:step:3;
variance1_0db = sqrt(1/(2.*(k_0+1)));
variance2_0db = sqrt(2/(2.*(k_0+1)));
mean1_0db=sqrt(k_0/(k_0+1)); % mean of underlying Gaussian random variables
mean2_0db=sqrt((2.*k_0)/(k_0+1));
parfor m=0:30
for n=0:30
c2=(1./(2.*variance1_0db.^2.*variance2_0db.^2)).*exp(-mean1_0db.^2/(2.*variance1_0db.^2)).*exp(-mean2_0db.^2./(2.*variance2_0db.^2)).*(1./((factorial(m).^2).*(factorial(n)).^2))* (((mean1_0db)./(2.*variance1_0db.^2)).^(2.*m)).*(((mean2_0db)./(2.*variance2_0db.^2)).^(2.*n))*((1./(2.*(variance2_0db.^2))).^(m-n));
f=(c2).*(range.^(2.*m+1)).*MeijerG({[1+m-n,1], []}, {[], []}, ((4.*variance1_0db.^2.*variance2_0db.^2)./(range.^2)));
a=a+f;
end
end
plot(range, a,'b');
and the m.file for the MeijerG is attached.
And here is the warning: > In MeijerG at 91 In parallel_function>make_general_channel/channel_general at 923 In remoteParallelFunction at 38

采纳的回答

Walter Roberson
Walter Roberson 2017-1-26
Your range variable starts at 0. You have a division by range. That gets you infinity at that location. You then try to calculate MeijerG at infinity; that returns back a symbolic placeholder that cannot be evaluated to a numeric value, which leads to the warning.
Solution: do not use 0 in range.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by