PROBLEM TO BE SOLVED: To accurately detect a static magnetic field and a variation magnetic field. SOLUTION: The magnetic sensor 10 comprises a coiled carbon fiber 11, a power supply 12 that is connected to both the ends through a copper wire, and a voltmeter 13 that is connected to both the ends of the coiled carbon fiber 11 as a measuring instrument. A constant current flows to the coiled carbon fiber 11 from the power supply 12, and a magnetic field is generated around the fiber 11. When the magnetic field sensor 10 is arranged in the ambient of the static magnetic field and the variation magnetic field, the strength of the magnetic field in the coiled carbon fiber 11 is changed due to the influence of the static magnetic field and the variation magnetic field, the voltage and electric resistance that are generated by it vary, and the variation value can be measured by the voltmeter 13. Then, a measurement result obtained by the voltmeter 13 is inputted to a computer 14 that is connected to the voltmeter 13, and magnetic flux density is calculated, thus detecting the height.