  The spin-polarization and magnetic coupling character of N-doped SrTiO3 and
BaTiO3 are studied through first-principles calculations. The substitutional N
doping at O sites leads to a half-metallic property and produces a magnetic
moment of 1.0 {\mu}B. The magnetic interaction between the nearest and
next-nearest N dopants results in a strong ferromagnetic coupling. When the
distance between the N dopants is larger than 7 {\AA}, the ground state of the
system tends to be paramagnetic. A nitrogen-concentration threshold to produce
the ferromagnetism is estimated. The calculated results give a good explanation
for the experimentally observed ferromagnetism in N-doped SrTiO3 and BaTiO3.
