Filter löschen
Filter löschen

warning in solving MeijerG function on Matlab?

2 Ansichten (letzte 30 Tage)
Deema42
Deema42 am 26 Jan. 2017
Kommentiert: Deema42 am 26 Jan. 2017
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

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 26 Jan. 2017
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.

Weitere Antworten (0)

Kategorien

Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by