Class: Noyes::PowerSpectrumFilter
- Inherits:
-
Object
- Object
- Noyes::PowerSpectrumFilter
- Includes:
- NoyesFilterDSL
- Defined in:
- lib/ruby_impl/power_spec.rb,
lib/common/noyes_dsl.rb
Overview
The square of the DFT. You must specify the number of ffts. The power spectrum returns an array of arrays where each inner array is of length nfft/2 + 1. The length of the outer array does not change.
Instance Method Summary (collapse)
- - (Object) <<(data)
-
- (PowerSpectrumFilter) initialize(nfft)
constructor
A new instance of PowerSpectrumFilter.
Methods included from NoyesFilterDSL
Constructor Details
- (PowerSpectrumFilter) initialize(nfft)
A new instance of PowerSpectrumFilter
7 8 9 |
# File 'lib/ruby_impl/power_spec.rb', line 7 def initialize nfft @nfft = nfft end |
Instance Method Details
- (Object) <<(data)
10 11 12 13 14 15 16 |
# File 'lib/ruby_impl/power_spec.rb', line 10 def << data nuniqdftpts = @nfft/2 + 1 data.map do |datavec| datavecfft = Noyes.dft datavec, @nfft Array.new(nuniqdftpts){|i| datavecfft[i].abs**2} end end |