Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Python code

Status
Not open for further replies.

dynaman

New member
Joined
Dec 17, 2011
Messages
75
Location
AU
Hi guys,

Does anyone have Python code for calculating vibration magnitude and phase shift using a PC sound card?

thanks

Mark.
 
no, but a rapid google led me to numpy

import audiolab, scipy
x, fs, nbits = audiolab.wavread(filename)
X = scipy.fft(x)

If you want the magnitude response:

import pylab
Xdb = 20*scipy.log10(scipy.absolute(X))
f = scipy.linspace(0, fs, len(Xdb))
pylab.plot(f, Xdb)
pylab.show()

which all seems jolly relevant to me

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376
 
I found that using FFT was quite slow and the results seemed to jump around a lot. My simple approach is to filter the imbalance signal and measure the difference at the zero crossings.
 
Time domain filtering has rather lost in popularity to an FFT approach, but if you are after a specific result it is often faster.

For example, real time fast slew rate antinoise systems use time signal filtering, they don't bother with frequency domain.

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376
 
Hey guys,

managed to get a simple program to detect phase shift using zero crossings. however I just discovered there is another method called the "wattmeter method". It is more robust from what I understand. Does anyone know how it works and how I could apply it to software code?

thanks

mark.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top