Rosemary Reid

02-26-1998, 08:51 PM

Dear Biomch-l,

Thank you to everyone who replied to my query about fourier analysis.

I think that by using cos and sine theta instead of cos and sine t I was

confusing everything so I am now using data which includes t.

This is a summary of the replies:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxx

Those who replied:

Christian Peham

University of Veterinary Medicine Vienna

Giannis Giakas PhD

Sport Health and Exercise

School of Health

Staffordshire University

At Hof

Department of Medical Physiology

University of Groningen

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Book suggestions

When you are

interested in programming a FFT, sou should have a look at the following

book: W.H.Press: "Numerical Recipies", Cambridge Press.

Hope this helps you. Regards

Martin

--

__________________________________________________ _____

Martin Pohl

Abteilung Unfallchirurgische Forschung und Biomechanik

Universitaet Ulm

Hemholtzstrasse 14

D-89081 ULM

Tel.: +49-(0)731-502-3494

FAX: +49-(0)731-502-3498

WWW: http://lyra.medizin.uni-ulm.de

e-mail: mailto://pohl@pollux.medizin.uni-ulm.de

__________________________________________________ _____

At first blush I would say there is nothing wrong with what you are trying

to do. One can apply the FT to any sort of periodic data. One question

I have is how to treat repeated measurements. Suppose you make measurements

both as the leg swings forward and backwards. Presumably these data would

be analysed separately. Would one average the data for the leg swinging

forward from several walking cyles? This seems to be appropriate since

you are trying to derive a time independent analysis of F(theta).

Peter HardyI would say that you can go on doing Fourier Analysis to the the

theta angle as the time axis. The same concept is employed e.g. for

spatial differentiation and spatial z-transformation, where time is

substituted by distance.

The only thing you should bear in mind is the new meaning of your

frequency. It is not a cyclic oscilation (sine/cosine) with variable

cycle duration. Instead, it will be some kind of angular frequency

difficult for me to conceptualize.

Ruben Lafuente-Jorge

Institute of Biomechanics of Valencia

P.O. Box 199

46980-Paterna (Spain)

E-Mail: rlafuent@ibv.upv.es

Tel: (96) 1366032

Fax: (96) 1366033

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

A very useful program in Matlab

hi,

as i understand fourier analysis -- the x axis can be anything

(time, angle, 5 gait cycle). i recently carried out a similar analysis on

gait data. i wrote several matlab functions -- i have attached one that

calculates the fourier coeff of a signal, if u're using matlab ie.

kavi bhalla

----------------------------------------------------------------------------

Kanwaljeet Singh Bawa Bhalla | Home Address :

Phd Student (biomechanics) | # G4, 301 Maple Ave

Mechanical and Aerospace Engineering | Ithaca, NY 14850

Cornell University | Ph :(607)256-7109

****************** email: ksb10@cornell.edu *****************************

************* http://talus.mae.cornell.edu/~bhalla ***********************

-----------------------------------------------------------------------------

"koi kisi ko raj na de hai, jise miley hai nij bal se miley hai"

Content-Type: TEXT/PLAIN; charset=US-ASCII; name="fourier.m"

Content-ID:

Content-Description:

%fourier.m

% when given an arbitrary signal , generates the fourier coeff for the

% signal. Based on "Vu and Esfandiari: Dynamic Systems : Modelling and

% Analysis, McGraw Hill pg 385."

%

% INPUTS : data : Nx2 matrix : signal : col1 : time

% col2:signal

% N : No of fourier coefficients to be used.

% typcially between 1000 and 5000

% T : Time Period. end time for most signals

% OUTPUTS :ao : const

% a : Nx1 matrix

% b : Nx1 matrix

function [a0,a,b]=fourier(data,T,N)

[n,junk]=size(data(:,1));

endtime=data(n,1);

ti=linspace(0,endtime,N);

f1=interp1(data(:,1),data(:,2),ti);

p=T;

a0=0;

a=zeros(N,1);

b=zeros(N,1);

deltat=T/N;

a0= a0+ sum(f1)*deltat*2/p;

for i=1:N

a(i)=a(i)+ sum(f1.*cos(2*i*pi*ti'/p))*deltat*2/p;

b(i)=b(i)+ sum(f1.*sin(2*i*pi*ti'/p))*deltat*2/p;

end;

% the following (if activated) generates a sample based on the above

% generated fourier coeffs and plots them.

%

% f=ones(N,1)*a0/2;

% for i=1:N

% f=f+ a(i)*cos(2*i*pi*ti'/p) + b(i)*sin(2*i*pi*ti'/p);

% end

% hold on

% plot(ti,f1,'xr')

% plot(ti,f) % generated

Dear Rosemary

I have just seen your message because I was away so here are my late

comments:

The equation you describe is correct if your data series is defined

over 0-360 deg. By entering N data points a standard FFT algorithm

will calculate N/2 harmonics. The problem is that if you do not

specify the period of your data in seconds you cannot calculate the

frequency of those harmonics in Hz: Fn=(1/T)*n where n is the

frequency number (n=1..N/2), T is your period and Fn is the frequency

in Hz of the nth harmonic.

Expressed relative to time the equations are:

F(t)=Ao+Sum(Ansin(njt)+Bncos(njt))

where n=1..N/2 and j is the angular frequency (j=360/T or j=2pi/T

if you are working in radians)

Matlab or any other numerical analysis tool would do the job

although you have to be aware that some FFT algorithms are working

for number of data points equal to a power of two only. If you have

any problems finding a suitable algorithm Email your data to me and I

will run an appropriate Fourier Transformation.

Finally an excellent reference on FT is a book called: "The FFT

Fundamentals and Concepts" edited by R. Ramirez, Prentice-Hall.

All the best

Bill

Dr V. Baltzopoulos

Reader in Biomechanics

Department of Exercise and Sport Science

Manchester Metropolitan University

Hassall Rd

Alsager ST7 2HL

Great Britain

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Rosemary Reid

Department of Mechanical Engineering

Loughborough University

Loughborough

Leicestershire

LE11 3TU

U.K.

tel. 44 1509 223748

Thank you to everyone who replied to my query about fourier analysis.

I think that by using cos and sine theta instead of cos and sine t I was

confusing everything so I am now using data which includes t.

This is a summary of the replies:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxx

Those who replied:

Christian Peham

University of Veterinary Medicine Vienna

Giannis Giakas PhD

Sport Health and Exercise

School of Health

Staffordshire University

At Hof

Department of Medical Physiology

University of Groningen

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Book suggestions

When you are

interested in programming a FFT, sou should have a look at the following

book: W.H.Press: "Numerical Recipies", Cambridge Press.

Hope this helps you. Regards

Martin

--

__________________________________________________ _____

Martin Pohl

Abteilung Unfallchirurgische Forschung und Biomechanik

Universitaet Ulm

Hemholtzstrasse 14

D-89081 ULM

Tel.: +49-(0)731-502-3494

FAX: +49-(0)731-502-3498

WWW: http://lyra.medizin.uni-ulm.de

e-mail: mailto://pohl@pollux.medizin.uni-ulm.de

__________________________________________________ _____

At first blush I would say there is nothing wrong with what you are trying

to do. One can apply the FT to any sort of periodic data. One question

I have is how to treat repeated measurements. Suppose you make measurements

both as the leg swings forward and backwards. Presumably these data would

be analysed separately. Would one average the data for the leg swinging

forward from several walking cyles? This seems to be appropriate since

you are trying to derive a time independent analysis of F(theta).

Peter HardyI would say that you can go on doing Fourier Analysis to the the

theta angle as the time axis. The same concept is employed e.g. for

spatial differentiation and spatial z-transformation, where time is

substituted by distance.

The only thing you should bear in mind is the new meaning of your

frequency. It is not a cyclic oscilation (sine/cosine) with variable

cycle duration. Instead, it will be some kind of angular frequency

difficult for me to conceptualize.

Ruben Lafuente-Jorge

Institute of Biomechanics of Valencia

P.O. Box 199

46980-Paterna (Spain)

E-Mail: rlafuent@ibv.upv.es

Tel: (96) 1366032

Fax: (96) 1366033

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

A very useful program in Matlab

hi,

as i understand fourier analysis -- the x axis can be anything

(time, angle, 5 gait cycle). i recently carried out a similar analysis on

gait data. i wrote several matlab functions -- i have attached one that

calculates the fourier coeff of a signal, if u're using matlab ie.

kavi bhalla

----------------------------------------------------------------------------

Kanwaljeet Singh Bawa Bhalla | Home Address :

Phd Student (biomechanics) | # G4, 301 Maple Ave

Mechanical and Aerospace Engineering | Ithaca, NY 14850

Cornell University | Ph :(607)256-7109

****************** email: ksb10@cornell.edu *****************************

************* http://talus.mae.cornell.edu/~bhalla ***********************

-----------------------------------------------------------------------------

"koi kisi ko raj na de hai, jise miley hai nij bal se miley hai"

Content-Type: TEXT/PLAIN; charset=US-ASCII; name="fourier.m"

Content-ID:

Content-Description:

%fourier.m

% when given an arbitrary signal , generates the fourier coeff for the

% signal. Based on "Vu and Esfandiari: Dynamic Systems : Modelling and

% Analysis, McGraw Hill pg 385."

%

% INPUTS : data : Nx2 matrix : signal : col1 : time

% col2:signal

% N : No of fourier coefficients to be used.

% typcially between 1000 and 5000

% T : Time Period. end time for most signals

% OUTPUTS :ao : const

% a : Nx1 matrix

% b : Nx1 matrix

function [a0,a,b]=fourier(data,T,N)

[n,junk]=size(data(:,1));

endtime=data(n,1);

ti=linspace(0,endtime,N);

f1=interp1(data(:,1),data(:,2),ti);

p=T;

a0=0;

a=zeros(N,1);

b=zeros(N,1);

deltat=T/N;

a0= a0+ sum(f1)*deltat*2/p;

for i=1:N

a(i)=a(i)+ sum(f1.*cos(2*i*pi*ti'/p))*deltat*2/p;

b(i)=b(i)+ sum(f1.*sin(2*i*pi*ti'/p))*deltat*2/p;

end;

% the following (if activated) generates a sample based on the above

% generated fourier coeffs and plots them.

%

% f=ones(N,1)*a0/2;

% for i=1:N

% f=f+ a(i)*cos(2*i*pi*ti'/p) + b(i)*sin(2*i*pi*ti'/p);

% end

% hold on

% plot(ti,f1,'xr')

% plot(ti,f) % generated

Dear Rosemary

I have just seen your message because I was away so here are my late

comments:

The equation you describe is correct if your data series is defined

over 0-360 deg. By entering N data points a standard FFT algorithm

will calculate N/2 harmonics. The problem is that if you do not

specify the period of your data in seconds you cannot calculate the

frequency of those harmonics in Hz: Fn=(1/T)*n where n is the

frequency number (n=1..N/2), T is your period and Fn is the frequency

in Hz of the nth harmonic.

Expressed relative to time the equations are:

F(t)=Ao+Sum(Ansin(njt)+Bncos(njt))

where n=1..N/2 and j is the angular frequency (j=360/T or j=2pi/T

if you are working in radians)

Matlab or any other numerical analysis tool would do the job

although you have to be aware that some FFT algorithms are working

for number of data points equal to a power of two only. If you have

any problems finding a suitable algorithm Email your data to me and I

will run an appropriate Fourier Transformation.

Finally an excellent reference on FT is a book called: "The FFT

Fundamentals and Concepts" edited by R. Ramirez, Prentice-Hall.

All the best

Bill

Dr V. Baltzopoulos

Reader in Biomechanics

Department of Exercise and Sport Science

Manchester Metropolitan University

Hassall Rd

Alsager ST7 2HL

Great Britain

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Rosemary Reid

Department of Mechanical Engineering

Loughborough University

Loughborough

Leicestershire

LE11 3TU

U.K.

tel. 44 1509 223748