  Nanowire photodetectors are investigated because of their compatibility with
flexible electronics, or for the implementation of on-chip optical
interconnects. Such devices are characterized by ultrahigh photocurrent gain,
but their photoresponse scales sublinearly with the optical power. Here, we
present a study of single-nanowire photodetectors displaying a linear response
to ultraviolet illumination. Their structure consists of a GaN nanowire
incorporating an AlN/GaN/AlN heterostructure, which generates an internal
electric field. The activity of the heterostructure is confirmed by the
rectifying behavior of the current-voltage characteristics in the dark, as well
as by the asymmetry of the photoresponse in magnitude and linearity. Under
reverse bias (negative bias on the GaN cap segment), the detectors behave
linearly with the impinging optical power when the nanowire diameter is below a
certain threshold ($\approx$ 80 nm), which corresponds to the total depletion
of the nanowire stem due to the Fermi level pinning at the sidewalls. In the
case of nanowires that are only partially depleted, their nonlinearity is
explained by a nonlinear variation of the diameter of their central conducting
channel under illumination.
