How do I generate a plot in a vector having symbols?

Here is a part of my code where I'm facing problem.
Note: P_Trans, gammaD, gammaE are 1x5 double and N, miuD, miuE, miuP, lambdaD, lambdaE, lambdaP, alphaD, alphaE, alphaP, gamma_D, gamma_E are all 1x1 double.
syms n z
x(n) = (1/alphaE)*(alphaD*(miuD*N+n)/2+alphaP*miuP/2);
phi1=matlabFunction(x);
y(n) = phi1(n) + N*miuE/2;
phi2=matlabFunction(y);
MeijerG=exp(-z);
Psc(z) = (2.^(2-alphaE-alphaP*(alphaE+1))).*epsilonE.*epsilonP./((pi.^(alphaE+alphaP*(alphaE+1)-2).*gamma(N.*miuD))).*symsum(((((-1)^n)/factorial(n))*((lambdaD.^(N.*miuD+n))./(N.*miuD+n)).*((z.^(alphaE.*phi1(n))).*((z-1).^(alphaP.*miuP/2))./(gamma(-alphaD.*(N.*miuD+n)/2).*alphaE.^(alphaD.*(N.*miuD+n)/2+1/2)).*(((lambdaE.^2)/4).^(-phi2(n)).*((alphaP).^(2*phi2(n)-alphaD.*(N.*miuD+n)/2-3/2))).*MeijerG)), n, 0, Inf);
Psec=matlabFunction(Psc);
x = -10:110/(N-1):100;
fplot(P_Trans, Psec(x),'-ro')
Note: P_Trans and Psec(x) are of same length.
After executing handle 'Psec' matlab is giving indefinite answers if I try to disp() it. I tried to generate a plot() it doesn't give Psec(x) on a plot because it has symbols. Here, converting Psec to double also generates an error. And I found out fplot helps in showing sym variables on a graph, but it is running forever. Need help. Please. I'm new to matlab and I know very little, just working on it for an assignment.
Did I use matlabFunction correctly?
Is it a problem caused by symsum? Is there any other easy way to do this?

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 10월 30일

0 개 추천

There are several unknown (not predefined) variables without which it is impossible to get any values and plots, as well. Check these variables:
alphaE, alphaD, miuD, N, etc.

댓글 수: 1

sai manas duddu
sai manas duddu 2021년 10월 30일
편집: sai manas duddu 2021년 10월 30일
I'm getting some values, that's not the problem. May be this image will help in some way.

댓글을 달려면 로그인하십시오.

카테고리

제품

릴리스

R2021a

질문:

2021년 10월 30일

편집:

2021년 10월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by