% Code to compute sigma points from a given data-set
% Author: Saurabh Prasad
% Last Modified: November 12, 2005.

function [sigma] = sigmapt(x,mu_x,P_x,L)

lambda = 3 - L;
num_sigma = 2*L+1;


mid = (num_sigma+1)/2;
sigma(mid,:) = mu_x;
ctr = 1;
for i = 1 : mid-1
    column_add = sqrt((L+lambda)*P_x);
    sigma(i,:) = mu_x-column_add(:,ctr)';
    ctr = ctr + 1;
end;
ctr2 = 1;
for j = mid+1 : num_sigma
    column_add = sqrt((L+lambda)*P_x);
    sigma(j,:) = mu_x+column_add(:,ctr2)';
    ctr2 = ctr2 + 1;
end;
