Matlab - symsum with itegral

2 views (last 30 days)
GSM
GSM on 11 Dec 2015
Answered: Walter Roberson on 11 Dec 2015
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.

Accepted Answer

Walter Roberson
Walter Roberson on 11 Dec 2015
Do not use integral() for symbolic expressions: use int()

More Answers (0)

Community Treasure Hunt

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

Start Hunting!