20.01.2015 Views

njit-etd2003-081 - New Jersey Institute of Technology

njit-etd2003-081 - New Jersey Institute of Technology

njit-etd2003-081 - New Jersey Institute of Technology

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

277<br />

x = decimate(rawdata,10);<br />

N = length(x);<br />

%*sf = 1000;<br />

%*N = 500;<br />

%%T = 1/400;<br />

ws = T*sf;<br />

%*nfft = 256;<br />

%*wave = 'mexh';<br />

Tool Box v 2.0<br />

% decimate data array<br />

% number <strong>of</strong> samples<br />

% sampling frequency<br />

% number <strong>of</strong> samples<br />

% window size in seconds (1/400 = 0.025 sec)<br />

% window size in samples<br />

% fft size in spectrogram command. Must be larger than<br />

% window size in samples<br />

% the wavelet to use (see wavelets table in Matlab Wavelet<br />

t = ( (1:(N)) )* (1/s0;<br />

f= ( (0:(N-1))/N) * sf;<br />

index = 1:N;<br />

% times<br />

% frequencies<br />

% first construct the time domain and frequency domain plots<br />

fx = abs(fft(x));<br />

% spectrumlD.m<br />

% function [Pyy,f]=rspec(x,Fs)<br />

fftsize=length(x);<br />

% put alternative fft method here<br />

x=x-mean(x);<br />

fftx=fft(x,fftsize);<br />

Pyy=fftx.*conj(fftx)/fftsize;<br />

% f=sf*(0:(fftsize/2-1))/fftsize;<br />

f=sPc(0:(fftsize-1))/fftsize;<br />

clear fftx<br />

P=PYY;<br />

figure;<br />

subplot(2,1,1)<br />

plot(t,x);<br />

% axis([0 20 -2 5]);<br />

grid on;<br />

xlabel('Time (sec)');<br />

ylabel('Amplitude');<br />

title(['Raw data in time domain <strong>of</strong>',eval('filename')]);<br />

subplot(2,1,2);<br />

% plot(f(400:800),p(400:800)/max(p),'r');<br />

plot(f(1:200),p(1:200)/max(p),er');

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!