## kalman filter parameters #the actual, hidden state actual = numpy.array([[0, 5]]) #the sensor sensor = Mvn(vectors=[[1, 0], [0, 1]], var=[1, numpy.inf]) #the system noise noise = Mvn(vectors=[[1, 0], [0, 1]], var=numpy.array([0.5, 1])**2) #the shear transform to move the system forward transform = Matrix([[1, 0], [0.5, 1]]) filtered = sensor.measure(actual) ## initial plot ax = newAx(fig) #plot the initial actual position ax.plot(actual[:, 0], actual[:, 1], **actualParams) ax.set_title('Kalman Filtering: Start') pylab.xlabel('Position') pylab.ylabel('Velocity') P.publish(fig) #measure the actual position, and plot the measurment filtered.plot(facecolor=colors['Filter Result'], **otherParams) ax.set_title('Initialize to first measurement')
## kalman filter parameters #the actual, hidden state actual = numpy.array([[0, 5]]) #the sensor sensor = Mvn(vectors = [[1, 0], [0, 1]],var = [1, numpy.inf]) #the system noise noise = Mvn(vectors = [[1, 0], [0, 1]], var = numpy.array([0.5, 1])**2) #the shear transform to move the system forward transform = Matrix([[1, 0], [0.5, 1]]) filtered = sensor.measure(actual) ## initial plot ax = newAx(fig) #plot the initial actual position ax.plot(actual[:, 0], actual[:, 1], **actualParams) ax.set_title('Kalman Filtering: Start') pylab.xlabel('Position') pylab.ylabel('Velocity') P.publish(fig)