Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I Calculating Magnetic Field Strength from FFT

  1. Apr 12, 2017 #1
    Hello All,

    Briefly on the exposition; I'm an undergraduate assistant to a professor. We contribute to the Muon g-2 experiment in Fermilab, designing and optimizing the magnetic-measurement equipment. As you might imagine I utilize the Fourier Transform often to analyze data. The data I'm analyzing is photo-current which comes from a laser of known power and is modulated by a magnetic field. The modulation by the magnetic field perturbs the plane of polarization in a well-defined manner (Faraday Rotation), resulting in a modulation of the intensity of photo-current and thus the voltage measured in our DAQ Assist box.

    I use LabView to analyze the data and thus use a proprietary "virtual instrument" in the program to do the FFT for me (obviously as the sheer amount of data would be overwhelming!). I understand the concept of an FFT, it being a mathematical tool to take a signal and decompose it into it's frequency domain and measure the strength of each frequency directly by their amplitude, as they contribute to the resultant "summed" signal. However what I need to understand is how to translate the amplitude of one of the frequencies (say 60 hz) into the amplitude for the magnetic field. In other words my professor wants me to be able to tell the magnetic field strength from the amplitudes present on our power spectrum. Now I have a few questions...

    i) Can this be done by simply analyzing one frequency and it's amplitude. My intuition says no as I would imagine the same strength magnetic field could produce different profiles for the power spectrum. However the way my professor puts it he makes it seem like he wants me to look and see "oh our 60 hz signal is at 1x10^-4, so that corresponds to a field of x Tesla"

    Well, I guess I don't have any more questions but if anyone could explain to me (or show me) how to go about calculating the strength of the magnetic field from the power spectrum that would be incredible.
    Last edited by a moderator: Apr 12, 2017
  2. jcsd
  3. Apr 12, 2017 #2
    I *think* the FFT amplitude goes like the original amplitude divided by sqrt(N), where N is the number of points. The quickest check is to feed your program some known data, like a simple sine function of known amplitude/frequency. Afterwards try checking a signal with two frequency components. Try varying their amplitudes, etc.

    I think I agree with your intuition about NOT being able to determine the field strength from one frequency component alone. I guess my question is, mathematically, what are you trying to find? Say your signal is something like Asin(x)+Bsin(2x)...clearly you can get A and B from the FFT...probably you can't get B from only knowing A unless you know explicitly how they're related...but what are you after? (A+B)? The rms amplitude? In the example that I gave, what do you define as field strength?
  4. Apr 12, 2017 #3
    Well the situation we have is the following: Basically, we have a function generator which creates an AC current of around 100 hz (which I have set to that frequency in order to separate from the common noise around 15hz and the higher harmonics) the AC current runs through a solenoid and creates and modulates the field so the magnetic field can take the form (according to my professor) of B(t) = Asin(ωt) where ω is the frequency (the frequency of the current which produces the field i.e., the 100 hz earlier) and where A is the amplitude. Here I am looking to be able to deduce the value of A from the amplitudes on the power spectrum.
  5. Apr 12, 2017 #4
    I see, so it's not that you're trying to infer complicated properties of a multicomponent signal, rather you know for a fact that your signal is as 100Hz? If that is the case, then I imagine the FFT amplitude at that frequency is directly proportional to the field strength. Try increasing the current by a factor of 2 (or some realistic factor) and see if your FFT amplitude increases by the same factor. Then you know you only need the data for that frequency component (i.e. disregard the rest of the spectrum).

    Do you still need figure out the factor by which to multiply your FFT amplitude to get Tesla? I'm not sure I can help you there if your actual data is in units of volts, as you stated. This will probably depend on the specifics of your system.
  6. Apr 12, 2017 #5
    Yeah see I was curious about that. I suppose I should have specified when talking with my professor as in our power spectrum we narrow our range to around 15hz - 200 hz in order to actually see the data we're interested in (specifically the 100 hz signal and also we monitor the 60 hz noise as that will be the signal frequency in the actual experiment - we'd like to see what sort of signal to noise we can achieve in order to be able to tell what's real signal and whats just 60 hz noise in the axtual experiment) and obviously there are components of that power spectrum (like the 60 hz noise, and other well-defined peaks in the power spectrum) which are due to outside noise which is being picked up somewhere in our system (perhaps on the laser beam, or induced by the coils of the solenoid, or in the cables which connect our system, etc..) and so I should have asked if he meant that I should gather the information about the magnetic field strength from THOSE peaks or simply just the signal which is associated with the frequency of the current which drives the magnetic field in the first place.

    So you're thinking the magnetic field strength is directly proportional to the FFT amplitude at the frequency the current is oscillating at? In other words the other components of the power spectrum (i.e., the well-defined noise peaks and background noise) don't contribute to the magnetic field strength calculation?

    I shall try exactly what you suggested tomorrow in order to verify the proportionality though I'm unsure how exactly I'd determine that factor which actually yields the value (not just verifies proportionality) of the magnetic field from the amplitude of the FFT at the particular relevant frequency, given your hypothesis is correct? Are you sure of any way I might be able to find this out? It has to do with system specifications, it's not just something with the formula for calculating a Fourier Transform?
  7. Apr 13, 2017 #6
    Hmm, finding the conversion factor (FFT -> B-field). Well, the amplitude that is measured is a voltage due to the photo-current? The photo-current is produced by a laser, whose polarization angle (and therefore intensity) varies due to the Faraday Effect? The angle of rotation is directly proportional to B, but the intensity goes like cos(theta)^2 (i.e. law of Malus). The amplitude of the signal will be (max-intensity - min-intensity), so proportional to (cos(theta1)^2 - cos(theta2)^2), where theta1 and theta2 are proportional to the max and min field magnitudes. I'm just making it up as I go along, but hopefully this will put you on a productive track.
  8. Apr 13, 2017 #7
    The scaling of the FFT depends on the particular convention used in the software package. The FFT might be scaled by 1, 1/n, or sqrt(1/n). In these cases, the inverse FFT would be scaled by 1/n, 1, and sqrt(1/n), respectively, such that the composition has the scaling 1/n. This is needed such that g = iFFT(FFT(g)).
    The particular convention should be given in the documentation for the FFT, but if not, it's simple to find by experimenting with the function.

    If the scaling convention is 1, then the amplitude spectrum for g is just given by |FFT(g)|. So the value of |FFT(g)| at 100Hz will just be the coefficient A in the term A*cos(2*pi*100Hz*t). In another convention, you may need to multiply by n or sqrt(n) or some other value, where n is the number of points in the FFT.

    By the way, since you have a known precise signal frequency, you should probably window your data to reduce scalloping loss.
    Scalloping loss is an issue if your sample rate is not perfectly synchronized with your signal, then your signal will bleed across different FFT bins and cause the amplitude of the FFT signal to be lower than the signal amplitude, depending on how far "between" FFT bins your signal lies.
    The Flat Top window is designed for this type of situation.

    When you multiply by a window, it decreases the amplitude of the signal, so you need to multiply by a factor to restore the original signal amplitude. It's possible that the software package already has built in features to do this.
  9. Apr 13, 2017 #8
    Okay so I tried inputting a known signal of 5cos(2*pi*100Hz*t) and ended up seeing a peak at 100hz of exactly magnitude 5. I tried again with a signal like 10cos(2*pi*90Hz*t) and, again, found at 90 hz the only peak, with magnitude 10. This led me to believe the scaling factor was 1 but when I reported to my professor he made it seem as though it depends on a 1/n or sqrt(1/n) (in other words it's not a scaling factor of 1 he heavily implied).

    So I'm a little unsure of how to proceed. What can I do to show the scaling factor is 1/n or sqrt(1/n) if my fft amplitude always matches my amplitude of magnetic field strength?

    He mentioned I should attempt to do a FT analytically and that should elucidate the nature of the scaling factor for me. This is what I've done so far:

    - The function I am transforming if f(t) = 5cos(2*pi*100*t) and I'm sampling it four times a second so that the fundamental frequency is 4Hz and thus the period is 1/4s so I make the substitution: t = Tsk = k/4 and sample from t = 0 to t = 1 thus giving me N = 5

    - Making the substitution f(t) → f(k); f(k) = 5cos(200*pi(k/4)) = 5cos(50*k*pi) where now we have
    - f(0) = 5cos(0) = 5
    - f(1) = 5cos(50*pi)
    - f(2) = 5cos(100*pi)
    - f(3) = 5cos(150*pi)
    - f(4) = 5cos(200*pi)

    Now to calculate F(n) = ∑k=oN-1 f(k)*e-i*2*pi*(n/N)*k

    - Thus for F(0) I see that n = 0 and the exponents are all zero thus making e^(0) = 1 and leaving me with
    - F(0) = f(0) + f(1) + f(2) + f(3) + f(4)
    Then since n runs to (N-1 = 4) we do this for F(1), F(2), F(3) and F(4). But Im still a little confused on how to interpret this...
    - Would I, in my case, calculate F(100) and that should give me the amplitude of the 100 Hz signal and then to get the b field would I use the inverse transform for the function F(100), again if I want to calculate the magnetic field strength from my signal?
  10. Apr 13, 2017 #9
    If your FFT amplitude matches your coefficient to the cosine term, then everything is fine.
  11. Apr 14, 2017 #10
    This is what I would imagine but upon reporting this to my professor he seemed to not be too pleased with that. I'm gonna do some more digging around to see what I can find/discover. Can anyone help me with the very last bullet point -- "Would I, in my case, calculate F(100) and that should give me the amplitude of the 100 Hz signal and then to get the b field would I use the inverse transform for the function F(100), again if I want to calculate the magnetic field strength from my signal?" -- I just want to make sure I've got the calculation down on a conceptual and mathematical basis.
  12. Apr 14, 2017 #11
    If you are sampling at 4Hz, why do you have signal frequencies of 25 ... 100 Hz?
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted