Applying Principle Component Analysis (PCA) on human motion signal after undergoes several signal processing.

16 views (last 30 days)
I have 30 sets of data containing various human motion signals (walking, running, etc). Each data consists of time-domain signal of one 1000000x1 array (data) and one 1000000x1 array (time). I am required to extract information and determine whether the signal is either running or walking. From my signal processing procedures, I've done high pass filtering, FFT and power spectrum density(PSD). Now I am required to perform PCA to clustered the motion signals. All 30 sets of data will undergo the same procedures. I'm having trouble to perform PCA on the data after undergoes the procedures up until PSD. Below is my coding that I've done for signal processing:
%%Setting up parameters:
load('Walk.mat');
Fs = 50000; %Sampling frequency
inpSig = data;
nFFT = 2*length(inpSig);
%%Adding highpass filter
Fc = 0.4;
fs = Fs/2;
Wn = Fc/fs;
order = 2;
[c3,c2] = butter(order,Wn,'high');
InpSig= filter(c3,c2,inpSig);
%%Perform the Fourier Transform
freqRes = Fs/nFFT;
freqAxisLab = freqRes*[0:nFFT-1]; % calculate the labels for the frequency axis
inpSigFFT = fft(InpSig,nFFT); % FFT calculation
inpSigFFT = abs(inpSigFFT);
%%Do Power Spectrum Density
inpSigPSD = inpSigFFT.*conj(inpSigFFT)/nFFT; % power spectral density
inpSigPSD = abs(inpSigPSD(1:floor(nFFT/2)));
%%Speed normalization
normalised=10*log10(inpSigPSD/max(inpSigPSD));
SpeedNormalised = resample(normalised,50,round(10*1.4));
%%plot signal
figure
plot(freqAxisLab(1:600),SpeedNormalised(1:600),'b')
ylabel('PSD(dB)')
xlabel('Frequency(Hz)')
I'm trying to use the function princomp to get the PCA. So my coding to execute the PCA from my final PSD result would be:
[pc,score,latent,tsquare] = princomp(SpeedNormalised);
However, I'm having trouble to plot the signal. Which syntax of [pc,score,latent,tsquare] should I use to plot the signal? Based on my readings, by right I should get the result as shown in figure below but I keep getting an error. I attached one of the data (Walk.mat). I appreciate any tutorial, review, guidance. Thank you in advance

Answers (1)

Star Strider
Star Strider on 8 Dec 2015
You are only analysing one record. You simply can’t do any sort of comparative statistics on one record. Please attach a running record for the same subject.
Also, what are we looking at? It seems to be a single 10-second record of something as a function of time.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!