Matlab - symsum with itegral

2 次查看(过去 30 天)
Hello,
I am trying to calculate the following:
I am using the following code:
clear all;
close all
clc;
SNR0dB = 40;
SNR0 = 10 ^ (SNR0dB / 10);
LaserIntensity = 1877;
EffNoisePower = 4;
tmp_sigma = 20;
m=1;
rho=0.5;
H=1;
load coeffs
C = sqrt(SNR0*EffNoisePower) / LaserIntensity;
Zn_1 = inf;
Zn = C / 0.204;
syms k x
S1 = symsum(( ((rho*m)/(H^2*(1-rho^2)))^(m+2*k-1) ) * (1/(factorial(k)*gamma(m+k))) * integral(@(r1) r1.^(2*m+2*k+1).*exp((-r1.^2.*m)/(H^2*(1-rho^2))),Zn,Zn_1), k, 0, 10)
I get the following error:
Error using integralCalc/finalInputChecks (line 511)
Input function must return 'double' or 'single' values. Found 'sym'.
Error in integralCalc/iterateScalarValued (line 315)
finalInputChecks(x,fx);
Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 83)
[q,errbnd] = vadapt(@AToInfInvTransform,interval);
Error in integral (line 88)
Q = integralCalc(fun,a,b,opstruct);
Error in SumOverIntegral (line 21)
S1 = symsum(( ((rho*m)/(H^2*(1-rho^2)))^(m+2*k-1) ) * (1/(factorial(k)*gamma(m+k))) * integral(@(r1)
r1.^(2*m+2*k+1).*exp((-r1.^2.*m)/(H^2*(1-rho^2))),Zn,Zn_1), k, 0, 10)
Can someone please help how to overcome the error of sending symbol to the integral function?
Thank you.

采纳的回答

Walter Roberson
Walter Roberson 2015-12-11
Do not use integral() for symbolic expressions: use int()

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by