我想问如何在 MATLAB 中计算以下积分。
integral( PN(x,m,s), x(-Inf,Inf) , m>0 , s>0.
我创建了一个函数文件,pn
,它是:
function PN = pn(x,m,s)
PN = exp(-(x-m).^2 ./ (2*s.^2)) ./ sqrt(2*pi*s.^2);
end
和一个脚本begin.m
:
%ezplot(@(x)pn(x,0,1),[-3,3]) --> This is OK!
quad(pn(x,m,s),x,-Inf,Inf) --> I can't manipulate this, I tried several ways.
积分的答案必须是“1”。