#!/usr/bin/ruby =begin 単純な入力信号を作る、フォーマットは070423/log_F_CSV.cppに準拠 =end $stderr.puts "Usage #{__FILE__} [length = 512, mode = sin, option = (period = 1) ...]" DELTA_T = 0.02 # 50Hz length = (ARGV.shift || 512).to_i mode = ARGV.shift || 'sin' time_data = [] case mode when "sin" time = 0.0 period = (ARGV.shift || 1.0).to_f # 1Hz length.times{|i| time_data << [time, Math::sin(Math::PI * 2 * time / period)] time += DELTA_T } end time_data.each_with_index{|item, i| puts [i, *item].join(',') }