Skip to content

Instantly share code, notes, and snippets.

@AtsushiSakai
Last active December 20, 2015 20:29
Show Gist options
  • Save AtsushiSakai/6190687 to your computer and use it in GitHub Desktop.
Save AtsushiSakai/6190687 to your computer and use it in GitHub Desktop.
一次元の変数のガウス分布に基づくベイズ推定のサンプルプログラム
% -------------------------------------------------------------------------
%
% 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;
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