We study pseudospectral and spectral functions for Hamiltonian system Jy ′ − B(t) = λ∆(t)y and differential equation l[y] = λ∆(t)y with matrix-valued coefficients defined on an interval I = [a, b) with the regular endpoint a. It is not assumed that the matrix weight ∆(t) ≥ 0 is invertible a.e. on I. In this case a pseudospectral function always exists, but the set of spectral functions may be empty. We obtain a parametrization σ = σ τ of all pseudospectral and spectral functions σ by means of a Nevanlinna parameter τ and single out in terms of τ and boundary conditions the class of functions y for which the inverse Fourier transform y(t) = R ϕ(t, s) dσ(s) y(s) converges uniformly. We also show that for scalar equation l[y] = λ∆(t)y the set of spectral functions is not empty. This enables us to extend the Kats-Krein and Atkinson results for scalar Sturm -Liouville equation −(p(t)y ′ ) ′ + q(t)y = λ∆(t)y to such equations with arbitrary coefficients p(t) and q(t) and arbitrary non trivial weight ∆(t) ≥ 0.