The acoustic and entropy transfer functions of quasi-one-dimensional nozzles are studied analytically for both subsonic and choked flows with and without shock waves. The present analytical study extends both the compact nozzle solution obtained by Marble & Candel (1977) and the effective nozzle length proposed by Stow et al. (2002) and by Goh & Morgans (2011a) to non-zero frequencies for both modulus and phase through an asymptotic expansion of the linearized Euler equations. It also extends the piecewiselinear approximation of the velocity profile in the nozzle proposed by Moase et al. (2007) to any arbitrary profile or equivalently any nozzle geometry. The equations are written as a function of three variables, namely the dimensionless mass, total temperature and entropy fluctuations, yielding a first order linear system of differential equations with varying coefficients, which is solved using the Magnus expansion. The solution shows that both the modulus and the phase of the transfer functions of the nozzle have a strong dependence on the frequency. This holds for both choked flows and subsonic converging diverging nozzles. The method is used to compare two different nozzle geometries with the same inlet and outlet Mach numbers showing that, even if the compact solution predicts no differences between the transfer functions of the two nozzles, significant differences are found at non-zero frequencies. A parametric study is finally performed to calculate the indirect to direct noise ratio for a model combustor, showing that this ratio decreases at higher frequencies.