Archive

Archive for the ‘Formula’ Category

Running Variance

November 9, 2009 Leave a comment

Just in mid of the code wanted to find the Running Variance, just as habit typed and found not so good links.

1/N*[sum(i=1:N-1, Xi*Xi’) + X*X’] – (1/N^2)*[ sum(i=1:(N-1), Xi) + X][ sum(i=1:(N-1), Xi) + X]’

Matlab code for calculating the running Variance is as follow

%updating Mean

newMean = (newMean*(N-1) + X)/N;

sumOfSq = sumOfSq*(N-1)  + X*X';

covMat =  (1/N)*sumOfSQ - newMean*newMean'

Externally there are few links that are worth reading

2D Linear Box Spline; Matlab Code

April 20, 2008 Leave a comment

%matlab code for the 2D box Spline

function val = boxSplineLinear(X,Y)

val = max(0, 1- max(abs(X)+1/sqrt(3)*abs(Y), abs(Y)));