如何把这个cauchycdf函数改成laplacecdf呢?。
Mostrar comentarios más antiguos
如题,cauchycdf函数是我在网上找的附件中有分享给大家,那么可不可以将他改成拉普拉斯的累积分布函数laplacecdf呢?
cauchycdf是这样的
% Default values
a= 0.0;
b= 1.0;
% Check the arguments
if(nargin >= 2)
a= varargin{1};
if(nargin == 3)
b= varargin{2};
b(b <= 0)= NaN; % Make NaN of out of range values.
end
end
if((nargin < 1) || (nargin > 3))
error('At least one argument, at most three!');
end
% Calculate
p= 0.5 + atan((x-a)./b)/pi;
end
我想直接把倒数第二行直接改为
p= 0.5.*(1+sign(x-b).*(1-exp(-abs(x-a)./b)));但是不行,请教一下各位老师
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre 循环及条件语句 en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!