MATLAB dispalays Error in integralCa​lc/finalIn​putCheck

6 visualizzazioni (ultimi 30 giorni)
This is my code. I would like to plot p_c and p_d on the y-axis given the formula in the picture.
big_X0=10^(-27.96/10);
r=5;
P_tx_h = big_X0/(r^(-2));
alpha = 4;
delta = 2/alpha;
P_c = 1;%
P_d = 1;
T = 0:2:20;
big_X=10.^((0:2:20)/10);
r_dist = big_X/P_tx_h;
lambda_c = 0.01;
lambda_d = 0.01;
mu=0.7854;
Tplot= 10.^(0/10);
%mu = (delta/(1-delta)).*Tplot.* hypergeom([1, 1-delta], 2-delta,-Tplot);%use if you have symbolic maths toolbox
v = (Tplot.^delta).*gamma(1-delta).*gamma(1+delta);
lambda_c_eq_intf = lambda_c + (lambda_d.*(P_d/P_c).^delta).*(v./mu);
lambda_d_eq_intf = lambda_d + (lambda_c.*(P_c/P_d).^delta);
f_r_dist= @(r_dist) 2.*pi.*lambda_c.*r_dist.*exp(-pi*lambda_c.*r_dist.^2);
syms n
k1_r= (delta/(1-delta)).*Tplot.*r_dist.^2.* hypergeom([1, 1-delta], 2-delta,-Tplot);
k2_r= symsum((((-1).^(n+1).*((big_X./P_c).^n).*(r_dist.^(2+(n.*alpha))).* hypergeom([1, -delta-n],-delta-n + 1,-Tplot))/factorial(n).*((1+(n*alpha/2)))), n, 0, Inf);
k3_r= delta.*((P_c./big_X).^delta).*gammainc(delta, (r_dist.^(alpha).*(big_X./P_c)));
fun = @(r_dist) exp((-lambda_c_eq_intf.*pi).*(k1_r + k2_r -k3_r)).*f_r_dist;
p_c_uic = integral(fun,0,Inf);
plot(big_X,p_c_uic)

Risposte (1)

Walter Roberson
Walter Roberson il 20 Mag 2018
Why are you looping over k when you never use k in the loop? You are just doing the same calculation multiple times storing into the same location each time.
Your second integral us over r which would tend to suggest that you should be using r as your variable of integration. But you do not do that: your r is a constant value 5 and your variable of integration is x, which you ignore. Remember that the result of integration of an expression that is constant in the variable of integration is just the expression times the difference in bounds. The difference in bounds is infinite so the result of the integration is going to be sign() of the constant expression times infinity.
When I look at what you are integrating it looks rather likely to me that the constant expression is symbolic and not convertible to numeric as I think I see an unresolved symbol in it. integral() is strictly for numeric results.
  12 Commenti
Jan
Jan il 27 Giu 2018
@Oluwatosin Amodu: What does your flag mean? Do you want to ask Walter to remove this image from his comment? If so, please ask him clearly.
Walter Roberson
Walter Roberson il 27 Giu 2018
Equations cannot be copyrighted. Images can be copyrighted, but using a single image out of a paper for educational purposes is within fair use / fair dealing exemptions in most countries.

Accedi per commentare.

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by