Sha256: bf8ea6ebd9985919321a8155eddde059309b60951d991328f572e3868a78bea4

Contents?: true

Size: 502 Bytes

Versions: 22

Compression:

Stored size: 502 Bytes

Contents

#!/usr/bin/env ruby
# Analysis of the solar activity of 11-years cycle
# from the number of sunspots.
# This example is taken from the MATLAB user's manual Chap 13.

require("gsl")

year, sunspot = GSL::Vector.filescan("sunspot.dat")
N = year.size
ffted = sunspot.fft

#power = GSL.sqrt(ffted[1..(N-2)].to_complex2.abs2)*2/N
power = GSL.sqrt(ffted.to_complex2.abs2)*2/N
freq = GSL::Vector.linspace(1, N/2, power.size)/N
period = 1.0/freq
GSL::graph(period, power, "-C -g 3 -x 0 40 -X 'Period [year]'")

Version data entries

22 entries across 22 versions & 4 rubygems

Version Path
gsl-2.1.0.3 examples/fft/sunspot.rb
gsl-2.1.0.2 examples/fft/sunspot.rb
gsl-2.1.0.1 examples/fft/sunspot.rb
gsl-2.1.0 examples/fft/sunspot.rb
gsl-1.16.0.6 examples/fft/sunspot.rb
rb-gsl-1.16.0.5 examples/fft/sunspot.rb
rb-gsl-1.16.0.4 examples/fft/sunspot.rb
rb-gsl-1.16.0.3 examples/fft/sunspot.rb
rb-gsl-1.16.0.3.rc1 examples/fft/sunspot.rb
gsl-nmatrix-1.15.3.2 examples/fft/sunspot.rb
gsl-nmatrix-1.15.3.1 examples/fft/sunspot.rb
rb-gsl-1.16.0.2 examples/fft/sunspot.rb
rb-gsl-1.16.0.1 examples/fft/sunspot.rb
rb-gsl-1.16.0 examples/fft/sunspot.rb
rb-gsl-1.15.3.2 examples/fft/sunspot.rb
rb-gsl-1.15.3.1 examples/fft/sunspot.rb
blackwinter-gsl-1.15.3.2 examples/fft/sunspot.rb
gsl-nmatrix-1.15.3.0 examples/fft/sunspot.rb
gsl-1.15.3 examples/fft/sunspot.rb
gsl-1.14.7 examples/fft/sunspot.rb