forked from AtsushiSakai/MATLABRobotics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e8c6c8
commit 3465dc4
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
function cdf=normcdf(x,mu,sigma) | ||
%正規累積分布関数CDFと計算する関数 | ||
%StatticsToolBoxのnormcdf関数と同じ機能にしたつもり | ||
%参照: | ||
%正規累積分布関数 - MATLAB normcdf - MathWorks 日本 | ||
%http://jp.mathworks.com/help/stats/normcdf.html | ||
if nargin==1 | ||
mu=0; | ||
sigma=1; | ||
elseif nargin==2 | ||
sigma=1; | ||
end | ||
cdf=[]; | ||
resolution=10000; | ||
for i=1:length(x) | ||
xt = 0 : (x(i) / resolution) : x(i); | ||
cdf= [cdf sum(normpdf(xt,mu,sigma)* x(i)/resolution)]; | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
function pdf=normpdf(x,mu,sigma) | ||
% 正規分布の確率密度関数PDFを計算する関数 | ||
% StaticsToolBoxのnormpdf関数と同じ機能にしたつもり | ||
% 参照: | ||
% 正規分布 - MATLAB & Simulink - MathWorks 日本 | ||
% http://jp.mathworks.com/help/stats/normal-distribution.html | ||
|
||
if nargin==1 | ||
mu=0; | ||
sigma=1; | ||
elseif nargin==2 | ||
sigma=1; | ||
end | ||
|
||
prefix=1/sqrt(2*pi)/sigma; | ||
pdf=prefix.*exp(-(x-mu).^2./(2*sigma^2)); | ||
|