matlab 求密度函数期望>> F=@(u)(sqrt(2)*normpdf(u,0,1))F = @(u)(sqrt(2)*normpdf(u,0,1))>> quad(F,-1,1)ans =0.9655—————————————我是分割线————————————————————>> F=@(u)(sqrt(u)
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 19:18:04
matlab 求密度函数期望>> F=@(u)(sqrt(2)*normpdf(u,0,1))F = @(u)(sqrt(2)*normpdf(u,0,1))>> quad(F,-1,1)ans =0.9655—————————————我是分割线————————————————————>> F=@(u)(sqrt(u)
matlab 求密度函数期望
>> F=@(u)(sqrt(2)*normpdf(u,0,1))
F =
@(u)(sqrt(2)*normpdf(u,0,1))
>> quad(F,-1,1)
ans =
0.9655
—————————————我是分割线————————————————————
>> F=@(u)(sqrt(u)*normpdf(u,0,1))
F =
@(u)(sqrt(u)*normpdf(u,0,1))
>> quad(F,-1,1)
下面是错误提示:
Error using *
Inner matrix dimensions must agree.
Error in @(u)(sqrt(u)*normpdf(u,0,1))
Error in quad (line 72)
y = f(x,varargin{:});
为什么分割线上方可以算出,下方算不出?
matlab 求密度函数期望>> F=@(u)(sqrt(2)*normpdf(u,0,1))F = @(u)(sqrt(2)*normpdf(u,0,1))>> quad(F,-1,1)ans =0.9655—————————————我是分割线————————————————————>> F=@(u)(sqrt(u)
初步猜测,sqrt(2)显然是标量,而sqrt(u)就可能作为矢量了.
对策:把*改成.*