现代通信系统(实用MATLAB)第四章程序

源代码在线查看: expected.m

软件大小: 10 K
上传用户: jianmingcao
关键词: MATLAB 现代通信系统 程序
下载地址: 免注册下载 普通下载 VIP

相关代码

				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)];
				end
				args=[args,')'];
				funfcn1=['x.*',funfcn];
				e=eval(['quad(funfcn1,a,b,tol,[]',args]);
							

相关资源