MATLAB: Solving equation with integral numerically for variable

numerical integrationsolve

I have to solve a normalization equation (i.e., all proababilities have to sum up to 1) in order to determine the normalization constant. It was no problem to solve this using the symbolic toolbox. However, the computational performance is poor and therefore I want to solve it numerically but I haven't found a way to solve it so far. A simplified version of this problem is given below.
% Constant parameters
p1 = 0.02;
p2 = 0.25;
r1 = 0.2;
r2 = 0.3;
a1 = 1.0;
a2 = 1.0;
N = 20;
syms C1 x;
Y11=(r1+r2)/(p1+p2);
Y21=(r1+r2)/(p1+p2);
b1=(1/a1)*(r1*p2-r2*p1)*(1/(p1+p2)+1/(r1+r2));
fx00=C1*(exp(b1*x));
fx01=C1*(exp(b1*x))*Y21;
fx10=C1*(exp(b1*x))*Y11;
fx11=C1*(exp(b1*x))*Y11*Y21;
internal_behavior=int((fx00+fx01+fx10+fx11),'x',0,N);
F1=internal_behavior - 1;
C1=vpasolve(F1,C1);
Is there any way to solve this numerically? I tried to define the functions fx00, …, fx11 as anonymous functions @(x,C1) to integrate numerically. But I cannot use the int() command within vpasolve() . Any hint is highly appreciated.

Best Answer

C1=b1/((exp(b1*N)-1)*(1+Y21+Y11+Y11*Y21))
Best wishes
Torsten.
Related Question