expected.m

来自「详细介绍了cdma通信系统功率控制的算法」· M 代码 · 共 17 行

M
17
字号
function e=expected(funfcn,a,b,tol,p1,p2,p3)% EXPECTED Finds the expected value of a random variable %	   with probability density function 'funfcn' and %	   support [a,b].% 	   Y=EXPECTED('F',A,B,TOL,P1,P2,P3), finds the expected % 	   value of the function F defined in an m-file. The% 	   function can contain up to three parameters,P1,P2,P3.%	   tol=the relative error.args=[];for n=1:nargin-4  args=[args,',p',int2str(n)];endargs=[args,')'];funfcn1=['x.*',funfcn];e=eval(['quad(funfcn1,a,b,tol,[]',args]);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?