Function written in Java.
The magnetic Flux (B field) Vector (in the form of a 3 element array, that represents the x,y,z components of the vector) with units Teslas, from a rectangular bar magnet. The vector is of the B field at a specific x,y,z coordinate relative the the magnet (coordinate system origin is at the center of the magnet)
- x, y, z (type: double) are the coordinates of the point at which the B field is to be found in meters
- mx, my, mz (type: double) are the width, height, and depth of the rectangular bar magnet in meters
- mag_dir (type: double) is the vector of the magnetization of the magnet in A/m,
- it is confined to the y direction in A/m
- positive inputs represent a magnetization in the positive y direction
- i.e. the north end of the magnet is in the positive y direction
- i.e. the north end of the magnet is in the positive y direction
- negative inputs represent a magnetization in the negative y direction
- i.e. the south end of the magnet is in the positive y direction
- i.e. the south end of the magnet is in the positive y direction
- it is confined to the y direction in A/m
The equations used to calculate the magnetic field were found from journal 1 by Vlatko Cingoski and Hideo Yamashita, provided here in the Sources folder.