//Example 22.7 N=2000;//Number of loops l=2;//Length (m) n=N/l;//Number of loops per unit length (m^-1) I=1600;//Current (A) mu_0=4*%pi*10^-7;//Permeability of free space (T.m/A) B=mu_0*n*I;//Magnetic field strength (T) printf('Magnetic field strength inside the solenoid = %0.2f T',B) //Openstax - College Physics //Download for free at http://cnx.org/content/col11406/latest