% BALANCE
%
% When a human experiences a balance disturbance, muscles throughout the
% body are activated in a coordinated fashion to maintain upright stance.
% Researchers (Data courtesy of Torrence D.J. Welch, GaTech)
% were interested in uncovering the sensorimotor mechanisms responsible for
% coordinating this automatic postural response (APR) by
% perturbing the balance of a human subject standing upon a customized
% perturbation platform that translates in the horizontal plane.
%
% Platform motion characteristics spanned a range of peak velocities (5 cm/s
% steps between 25 and 40 cm/s) and accelerations (0.1g steps between 0.2
% and 0.4g) that were randomly varied in both forward and backward
% directions.
%
% The data included in balance2.mat represent smoothed surface
% electromyogram (EMG) responses to
% backward-directed perturbations in the medial gastrocnemius muscle (an
% ankle plantar flexor located on the calf) for 3 x 4=12 experimental conditions.
% There is one second of data, beginning at platform motion onset.
%
load('C:\STAT\Descriptive\Descriptivedat\balance2.mat')
%load balance2
%balance2 contains data set: data of size 1024 x 3 x 4
% data(:,1,1), data(:,1,4), data(:,1,7) and data(:,1,10)
% correspond to fixed acceletation = 0.2 and velocities
% = 25, 30, 35, and 40.
bal25 = data(:,1,1);
bal30 = data(:,1,4);
bal35 = data(:,1,7);
bal40 = data(:,1,10);%------------------
X = [bal25 bal30 bal35 bal40];
[n p]=size(X);
varNames = {'veloc25','veloc30','veloc35','veloc40'};
cX=X-repmat(mean(X),n,1);
% covariances and correlations
C=cov(X)
[coeffs, scores, latent] = pca(cX);
coeffs
latent
[V D]=eigs(C)
[u s v]=svd(cX,'econ');
v
s.^2/(n-1)
% figure(6)
% h = plot();
%
% set(h(:,3),'FontSize',10); set(gcf,'color','white');
% %print -depsc 'C:\Brani\Courses\bmestatu\Fall2007\arry6.eps'
scores(1:5)
sco2=cX*v; sco2(1:5)
sco3=cX*V; sco3(1:5)
close all
figure; pareto(latent)
m1=1; m2=2; %first and second PC
figure;
plot( scores(1:end,m1), scores(1:end,m2),'.-')
figure;
plot( (1:n)', sum(cX(:,:),2),'.-')
hold on
plot( (1:n)', scores(:,m1),'r.-')
figure;
biplot(coeffs(:,[1 2]), 'varlabels',{'1','2','3','4'});