请教一下一个积分的问题。

设f1=exp(-(a^2-2abcos(t)+b^2)/2);
f2=cos(t)*exp(-(a*cos(t)^2)/2)*erfc((b-a*cos(t))/sqrt(2));
q(a,b)=1/pi*int(f1,t,0,pi)+a/sqrt(2*pi)*int(f2,t,0,pi);
在这里q(a,b)=1-u2,u2=rand(1,N),即q(a,b)算是已知,a是已知,现在我想求的是b,请问表达出b的代码该怎么写?

 Réponse acceptée

xojaj
xojaj le 22 Nov 2022

0 votes

你这里的积分是不能够符号积分出来。所以不能够计算。
可以使用数值积分。特别对于积分里面以及积分上下限都有未知数的方程。
function y=myfun3(b,a,u2)
f1=@(t,b,a)exp(-(a^2-2*a*b*cos(t)+b^2)*(1/2));
f2=@(t,b,a)exp(-(a*cos(t).^2)/2).*erfc((2^(1/2)*(b - a*cos(t)))/2).*cos(t);
y=1/pi*integral(@(t)f1(t,b,a),0,pi)+a/sqrt(2*pi)*integral(@(t)f2(t,b,a),0,pi)+u2-1;
end
选择你需要的a 以及u2
如a=2,u2=0.9
b=fsolve(@(b,a,u2)myfun3(b,2,0.9),-2)
b= -3.3377

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB 快速入门 dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!