Calculating magnetic field I would like to calculate the magnetic field near a neodymium magnet (N35). With near I mean I have got a rod magnet of about 10 x 4 mm and I am interested in the field  from 0 mm under the magnet until 10 mm under the magnet down and also from 0 mm until about 10 mm to the right or left. I want to make a table in excel like 10 x 10. The difficult part is I want to know the field strength in x, y, and Z direction. at a given place. 
I did read a lot on internet but I can not find the solution. I did read this: https://en.wikipedia.org/wiki/Dipole#Field_of_a_static_magnetic_dipole
and in the paragraph: Field of a static magnetic dipole, they describe the field, I think I need this formula but I am not sure. But if I would need that one I still do not have the x,y,z directions. And how do I get the strength of the N35 neodymium magnet into the formula? 
I hope you can help me, thank a lot for the help
 A: It is probably a decent approximation to model the magnetic field as a magnetic field from a dipole. To get the magnetic field from a dipole, you just needed to scroll down a little bit (you can ignore the second term with the $\delta$).
In this case, $\mathbf{m}$ will point along the long axis of the bar magnet. If we take $\mathbf{m}$ to point along the $z$-axis, then the expression for the magnetic field becomes 
$$ \mathbf{B}=\frac{\mu_0 m}{4 \pi r^3} (3z \hat{r}/r - \hat{z}) = \frac{\mu_0 m}{4 \pi r^5} (3z\mathbf{r} - \hat{z}r^2); $$
in components, this is 
$$ \mathbf{B}=\frac{\mu_0 m}{4 \pi \sqrt{x^2+y^2+z^2}^5} (3zx,3zy,2z^2-x^2-y^2). $$
Now you say you know the residual flux density $\mathrm{B_r}$. According to wikipedia, this is related to the magnetic moment by the formula $m=\mathrm{B_r} V /\mu_0$, where $V$ is the volume of the magnet. Plugging this into the expression for the magnetic field, we get
$$ \mathbf{B}=\frac{\mathrm{B_r} V}{4 \pi \sqrt{x^2+y^2+z^2}^5} \left(3zx,3zy,2z^2-x^2-y^2\right). $$
Now if you didn't know the magnitude of $m$ or you wanted to double check your work, the best way I can think of to do it easily would be to take a gaussmeter and measure the field along the axis of the bar magnet (say 1 cm past the end, 2 cm past the end, etc). This of course requires a tool that can measure a magnetic field. 
Fortunately, most smartphones can do this and there are free apps. After reading this question, I searched the app store and downloaded an app called phyphox, and it kind of blew my mind. One of the things it can do is measure X,Y, and Z components of magnetic field. For me, Y was the long axis of the phone, and Z was the normal to the phone. You will have to do some experimenting to figure out where the magnetometer is located in your phone if you go this route. After doing this, you should be able to map out the magnetic field along the long axis of the bar magnet and see if it matches the prediction of the formula.
One caveat is that close to the magnet, higher multipole terms become important, so modeling the magnet as a pure dipole may not give you the best results. However, I believe it will be much more difficult to correctly account for the higher multipole terms.
A: For a NeFeB cylinder magnet a couple of equivalent quick approximations is that the field looks like that from a uniform density of monopoles on each face (oppositely signed of course), or is the field from a uniform sheet of current circling the axis on the curved outside of the magnet.
The integrals are easy to set up in Vector Calculus, typically hard to solve analytically - but can be numerically solved.
Then there are FEM solvers too https://www.supermagnete.de/eng/faq/How-do-you-calculate-the-magnetic-flux-density check the FEMM link.
It looks like several magnet manufacturers give online calculators for field strength on axis and by material - so you can just normalize your calcs to their values: https://www.dextermag.com/resource-center/magnetic-field-calculators/field-on-axis-of-cylindrical-magnet-calculator
