Skip to content

Instantly share code, notes, and snippets.

@ghdawn
ghdawn / BPNetwork.m
Created November 8, 2012 12:06
a example of BP Network to solve XOR problem
w1=(rand(3,2)-0.5).*2+0.1;
w2=(rand(3,1)-0.5).*2+0.1;
ita=1;
alpha=1;
%x=[1 1;1 3;1 2;1 4];
%x=[ones(4,1).*(-1) x];
x=[0 0;1 1; 1 0; 0 1];
h=[0 0 0 0]';
@ghdawn
ghdawn / learning.m
Created November 8, 2012 12:04
a example of perceptron(Artifial Neural Network)
function [w,flag] = learning(flag,w,omega,target )
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
ita=1;
result=(omega*w)>0;
result=target-result;
for i = 1 : 3
if result(i) == 0
continue
@ghdawn
ghdawn / kftest.m
Created November 9, 2012 02:16
one variable kalman filter test
% x : state vector [pos;speed]
% X : estimate vector
% n : noise vector - Q : cov.matrix
% z : measurement vector
% v : measurement noise - R : cov.matrix
%
% F_x : transition matrix
% F_n: noise matrix
% H : measurement matrix