We consider a one-dimensional
p-wave superconducting quantum wire with the modulated chemical potential, which is described by
$\hat{H}= \displaystyle\sum\nolimits_{i}\left[ \left( -t\hat{c}_{i}^{\dagger }\hat{c}_{i+1}+\Delta \hat{c}_{i}\hat{c}_{i+1}+ h.c.\right) +V_{i}\hat{n}_{i}\right]$
,
$V_{i}=V\dfrac{\cos \left( 2{\text{π}} i\alpha + \delta \right) }{1-b\cos \left( 2{\text{π}} i\alpha+\delta \right) }$
and can be solved by the Bogoliubov-de Gennes method. When
$b=0$
,
$\alpha$
is a rational number, the system undergoes a transition from topologically nontrivial phase to topologically trivial phase which is accompanied by the disappearance of the Majorana fermions and the changing of the
$Z_2$
topological invariant of the bulk system. We find the phase transition strongly depends on the strength of potential
Vand the phase shift
$\delta$
. For some certain special parameters
$\alpha$
and
$\delta$
, the critical strength of the phase transition is infinity. For the incommensurate case, i.e.
$\alpha=(\sqrt{5}-1)/2$
, the phase diagram is identified by analyzing the low-energy spectrum, the amplitudes of the lowest excitation states, the
$Z_2$
topological invariant and the inverse participation ratio (IPR) which characterizes the localization of the wave functions. Three phases emerge in such case for
$\delta=0$
, topologically nontrivial superconductor, topologically trivial superconductor and topologically trivial Anderson insulator. For a topologically nontrivial superconductor, it displays zero-energy Majorana fermions with a
$Z_2$
topological invariant. By calculating the IPR, we find the lowest excitation states of the topologically trivial superconductor and topologically trivial Anderson insulator show different scaling features. For a topologically trivial superconductor, the IPR of the lowest excitation state tends to zero with the increase of the size, while it keeps a finite value for different sizes in the trivial Anderson localization phase.