www.gusucode.com > MPSK,误码率性能仿真源码程序 > MPSK,误码率性能仿真源码程序/IET_MATLAB/functions/int_num.m

    % computing integral numerically
function Iout=int_num(func,teta_low,teta_high,n)
% inputs
% func: input parametric function needs to integrated
% teta_low : lower limit of the integral
% teta_high : higher limit of the integral
% n : resolution of numerical integral

dteta=(teta_high-teta_low)/n;
teta_low=dteta;

% numerical intergration
Iout=(func(teta_low)+func(teta_high))/2;
for k=1:n
    teta=teta_low+k*dteta;
    Iout=Iout+func(teta);
end
Iout=dteta*Iout;

end