# Fourier transform radial component of magnetic field

• Swordwhale
In summary: Fourier transform to change it to a frequency.In summary, the person is asking for help with a Fourier transformation. They have measured the magnetic field of a quadrupole and were told to calculate the radial component in polar coordinates. They have found a tutorial that explains how to do this but are not sure if that is what they need. They are stuck on the problem of how to get the frequency as the x-axis of the graph.

#### Swordwhale

Homework Statement
Use the fourier transformation to determine the radial component of the magnetic field of a quadrupole.
Relevant Equations
Br(x) = By cos (x) – Bx sin (x)
Hello everybody!

I have a question concerning the Fourier transformation: So far I have experimentially measured the magnetic field of a quadrupole but as the hall effect sensor had a fixed orientation I did two series, one for the x, one for y component of the magnetic field, I have 50 values each.

Now I was told I had to Fourier transform these components using for Br(x) = By cos (x) – Bx sin (x). But I am not sure how to do that. I have never worked with Fourier transformations before and did some research but while I get the idea about FTs I do not know how to apply it to this very case.

I'd really appreciate any kind of help - thank you all in advance!

Swordwhale said:
Homework Statement:: Use the Fourier transformation to determine the radial component of the magnetic field of a quadrupole.
Relevant Equations:: Br(x) = By cos (x) – Bx sin (x)

Hello everybody!

I have a question concerning the Fourier transformation: So far I have experimentially measured the magnetic field of a quadrupole but as the hall effect sensor had a fixed orientation I did two series, one for the x, one for y component of the magnetic field, I have 50 values each.

Now I was told I had to Fourier transform these components using for Br(x) = By cos (x) – Bx sin (x).

But I am not sure how to do that. I have never worked with Fourier transformations before and did some research but while I get the idea about FTs I do not know how to apply it to this very case.

I'd really appreciate any kind of help - thank you all in advance!

I take it that $B_x$ and $B_y$ are cartesian components, and you want the radial component in pane polar coordinates. So in less confusing notation what you are calculating is $$B_r(\theta) = B_y(\theta) \cos(\theta) - B_x(\theta)\sin(\theta).$$ Now you have values of $B_x$ and $B_y$ at what I assume are 50 distinct points equally spaced around a circle at fixed distance from the source. This gives you $B_x(\theta_k)$ and $B_y(\theta_k)$ for $\theta_k = 2\pi k/51$, $0 \leq k \leq 50$. It is then straightforward to calculate $B_r(\theta_k)$ and obtain the (discrete) Fourier transform of these using the software of your choice.

Last edited by a moderator:
Thank you very much for your reply - the only issue I have is that it still is not that straighforward to me: I just found a tutorial that explains how I could Fourier transform in Excle but I'm not really sure if that is exactly what I need. What would that software be you recommand?

Okay, I found a FFT-tool for Excel and tried to make it work. The columns Bx and By are my measured values, the column Br is calculated from the equation above (see the command line in the upper left corner). I then proceeded to make the FFT but the values generated do not seem like the result I expect from a FFT. Probably that's because I don't have the frequency as my x-axis. But that's where I'm stuck now - what is the frequency here? What do I do to get a frequency as my x-axis? Do I just plot it to 1/T?

Again - thanks a lot in advance!

https://i.ibb.co/qpYmf7v/image.png

My earlier post contained an error: $\theta_k = 2\pi k/50$ not $2\pi k/51$ as stated.

What you are trying to find are the coefficients $b_n$ in $$B_r(\theta) = \sum_{n=-24}^{25} b_ne^{in\theta}.$$ These are determined by requiring that $$B_r\left(\frac{2\pi k}{50}\right) = \sum_{n=-24}^{25} b_n\exp\left(\frac{2\pi i nk}{50}\right) = \sum_{m=0}^{49} b_m\exp\left(\frac{2\pi i mk}{50}\right)$$ for $0 \leq k \leq 49$ and the second equality follows by setting $m = n$ if $n \geq 0$ and $m = 50+n$ otherwise, as $\exp(2\pi i (50 + n)k/50) = \exp(2\pi i + 2\pi i nk/50) = \exp(2\pi i nk/50)$. This is the definition of a discrete Fourier transform.

You should not window the data, as you appear to have done: You expect $B_r$ to be periodic with period $2\pi$. From inspection, it looks like you will get the coefficients in the order $$n = 0, 1, \dots, 24, 25, -24, -23, \dots, -1.$$

Last edited:
Hey pasmith!

Thank you for your answer, I really appreciate you give your best to help me - I'm just afraid this post confused me even more. I have this equation given as the one I need to Fourier tranform:
$$B_r(x) = B_y \cos(x) - B_x\sin(x) \hspace{4 em} (i)$$

Now what I did is make one row $B_y$ and one row $B_x$ which I can put in $(i)$ to get a column $B_r$. For $x$ I entered $2 \pi \cdot (\frac{1}{50}+a_{n-1})$ with $a$ being the distance covered with each measurement.

When I Fourier transformed these values it gave me this function:

I know that the 50 I entered above is arbitrarily, I just didnt know what to put as sample rate. I guess its far from what it should be as I expect the resulting graph to just have one peak and I also do not know how to use all the data I have as for what I did I can only use powers of two as amount of transformed values - so this graph just uses the 32 ones in the center (when I used 64 I added 14 zero values as I don't have enough data which seemed to mess up the transformation).
Now this is where I'm at. I don't feel like this is how to approach my problem but that's just what I got so far.

Now your advice is to use a different function for $B_r$. But I do not understand how your equation will get me to the data. I know that at least the first part should be okay if written as sine/cosine so I will end up having another column for $B_r$ with 50 discrete values - is that right? Now those values are the ones I will have to Fourier transform. The excel add-in I use can only transform sets of 32 or 64 (and other powers of two respectivly) - is this some restriction that can be avoided? As far as I understood its not if I want to do a FFT? After I got those 50 values I just got their modulus (\IMBSA-function in Excel) and plotted the results (which you can see above). I feel like I am doing something conceptually wrong here but don't really understand what it is. You said I "windowed" my data - can you maybe tell me what that means (I'm no native speaker in english and have some problems when it comes to technical expressions)? I also feel like I should not get discrete values of $B_r$ but instead a periodic function as you mentioned in the last paragraph. But what are the values to Fourier transform than?

I'm really sorry - I appear to be lacking some important prerequisite when it comes to this topic. Please excuse if I'm totally off in some of my assumptions I just really try to understand what I need to do but the major point appears to be missing.

Thank you in advance for your answers so far and - hopefully - for those yet to come!

swordwhale

Delta2