Undefined unary operator '-' for input arguments of type 'function_handle'.
Afficher commentaires plus anciens
Hi everyone,
I am having some problems in using the integral functions, is there any suggestion for improving this code and fix the error?
Also, I tried to implement integral2 with limits which depend on other variables but it seems not possible...
Thank you in advance!
r_XR = @(theta, y) Ru(i1)*cos(theta) + sqrt(y.^2 - Ru(i1)^2 * (sin(theta)).^2 ) ;
thetaR = @(y) asin(y/Ru(i1)); % Ru(i1) is a constant
thetaR2 = @(y) -1*asin(y/Ru(i1));
r_mR = @(theta, y) Ru(i1)*cos(theta) - sqrt(y.^2 - Ru(i1)^2 * (sin(theta)).^2 ) ;
integrand_L = @(theta, y, z) z .* exp(-z.^2/(2*var)) ./ (1 + 1/tau * (z./ y).^alpha) ;
int_1La = @(theta,y) integral(@(z) integrand_L(theta,y,z), r_mR(theta, y), r_XR(theta, y), 'ArrayValued',true) ; % first integral
La = @(y) exp(lambda/(2*pi*var) * (integral(@(theta) int_1La(theta,y), thetaR2(y), thetaR(y), 'ArrayValued',true) - integral2(@(theta, z) integrand_L(theta,y,z), -pi, pi, 0, inf))) ;
I2a = @(theta, y) integral(@(r) lambda_r, r_mR(thetaR(y), y), r_XR(thetaR(y), y), 'ArrayValued',true) ;
integrand1_I1a = @(theta, y) lambda/(2*pi*var) * ( r_XR .* exp(-r_XR.^2/(2*var)) + r_mR .* exp(-r_mR.^2 /(2*var))) .* y./sqrt(y.^2 - (Ru(i1) * sin(theta)).^2) ;
I1a = @(y) 2.*I2a(thetaR, y) ./ sqrt(Ru(i1)^2 - y.^2) + integral(@(theta) integrand_I1a, -thetaR, thetaR, 'ArrayValued',true) ;
PDFa =@(y) exp(-integral(@(theta) I2a, -thetaR, thetaR, 'ArrayValued',true)) .* I1a(y) ;
integrand_Pca = @(y) exp(-tau/p*y.^alpha*N0/2).*La(y).*PDFa(y) ;
Pca = integral(integrand_Pca, 0, Ru(i1),'ArrayValued',true) ;
Undefined unary operator '-' for input arguments of type 'function_handle'.
Error in SimulationAnalysis_INH_CDFofX>@(y)exp(-integral(@(theta)I2a,-thetaR,thetaR,'ArrayValued',true)).*I1a(y)
Error in SimulationAnalysis_INH_CDFofX>@(y)exp(-tau/p*y.^alpha*N0/2).*La(y).*PDFa(y)
Error in integralCalc/iterateArrayValued (line 156)
fxj = FUN(t(1)).*w(1);
Error in integralCalc/vadapt (line 130)
[q,errbnd] = iterateArrayValued(u,tinterval,pathlen);
Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 88)
Q = integralCalc(fun,a,b,opstruct);
Error in SimulationAnalysis_INH_CDFofX (line 105)
Pca = integral(integrand_Pca, 0, Ru(i1),'ArrayValued',true) ;
2 commentaires
Adam
le 26 Fév 2020
How does this differ fromo your other question with an identical title?:
Maurilio Matracia
le 27 Fév 2020
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Whos dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!