Last active
December 20, 2015 20:29
-
-
Save AtsushiSakai/6190687 to your computer and use it in GitHub Desktop.
一次元の変数のガウス分布に基づくベイズ推定のサンプルプログラム
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
% ------------------------------------------------------------------------- | |
% | |
% File : BayesianFilter1D.m | |
% | |
% Discription : 1 dimentioanl Bayesian Filter Sample Program | |
% | |
% Environment : Octave (Matlab) | |
% | |
% Author : Atsushi Sakai | |
% | |
% Copyright (c): 2013 Atsushi Sakai | |
% | |
% License : Modified BSD Software License Agreement | |
% ------------------------------------------------------------------------- | |
function []=BayesianFilter1D() | |
close all; | |
clear all; | |
disp("1 dimentional Bayesian filter Sample Start!!"); | |
m=1; | |
v=1; | |
figure(1) | |
GaussianPlot(m,v,'b');hold on; | |
GaussianPlot(m+1,v+1,'r');hold on; | |
grid on; | |
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
function []=GaussianPlot(m,v,color) | |
x=[m-3*v:0.1:m+3*v]; | |
g=[]; | |
for i=1:length(x) | |
g=[g 1/sqrt(2*pi*v)*exp(-(x(i)-m)^2/(2*v))]; | |
end | |
plot(x,g,['-',color]); | |
grid on; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment