* psd: power spectral density via FFT (sibling of fft/spec)
B1 s 0 V = sin(2*3.14159*1k*time)
R1 s 0 1k
.tran 5u 10m
.control
  run
  psd 1 v(s)             $ 1 = smoothing/averaging length
  let p = db(v(s))       $ the PSD result lands back in v(s)
  meas sp pk MAX p
.endc
.end
