3d Magnetic Field Simulation Matlab