Sha256: 744aa1f70faff06e558a17660ce2700a62ff3da19af7db9c209a128d07308fc4
Contents?: true
Size: 1.61 KB
Versions: 2
Compression:
Stored size: 1.61 KB
Contents
#!/usr/bin/env ruby require("gsl") n = 256 nc = 20 data = GSL::Vector.alloc(n) data.fscanf("ecg.dat") w = GSL::Wavelet.alloc("daubechies", 4) work = GSL::Wavelet::Workspace.alloc(n) # Choose as you like... data2 = w.transform(data, GSL::Wavelet::FORWARD, work) #data2 = data.wavelet_transform(w, GSL::Wavelet::FORWARD, work) #data2 = data.wavelet_transform_forward(w, work) #data2 = w.transform(data, work) #data2 = w.transform(data) #data2 = w.transform(data, GSL::Wavelet::FORWARD) #data2 = w.transform_forward(data, work) #data2 = w.transform_forward(data) #data2 = GSL::Wavelet.transform(w, data, GSL::Wavelet::FORWARD, work) #data2 = GSL::Wavelet.transform(w, data, GSL::Wavelet::FORWARD) #data2 = GSL::Wavelet.transform(w, data, work) #data2 = GSL::Wavelet.transform(w, data) #data2 = GSL::Wavelet.transform_forward(w, data, work) #data2 = GSL::Wavelet.transform_forward(w, data) perm = data2.abs.sort_index i = 0 while (i + nc) < n data2[perm[i]] = 0.0 i += 1 end # Choose as you like... data3 = w.transform(data2, GSL::Wavelet::BACKWARD, work) #data3 = data2.wavelet_transform(w, GSL::Wavelet::BACKWARD, work) #data3 = data2.wavelet_transform_inverse(w, work) #data3 = w.transform(data2, GSL::Wavelet::BACKWARD) #data3 = w.transform_inverse(data2, work) #data3 = w.transform_inverse(data2) #data3 = GSL::Wavelet.transform(w, data2, GSL::Wavelet::BACKWARD, work) #data3 = GSL::Wavelet.transform(w, data2, GSL::Wavelet::BACKWARD) #data3 = GSL::Wavelet.transform_inverse(w, data2, work) #data3 = GSL::Wavelet.transform_inverse(w, data2) GSL::graph(nil, data, data3, "-T X -C -g 3 -x 0 #{data.size} -L 'Red: data, Green: DWT'")
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
gsl-1.16.0.6 | examples/wavelet/wavelet1.rb |
rb-gsl-1.16.0.5 | examples/wavelet/wavelet1.rb |