File: do_fft.sh

package info (click to toggle)
entropybroker 2.9-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,600 kB
  • sloc: cpp: 14,386; sh: 934; makefile: 188; java: 148; perl: 12
file content (27 lines) | stat: -rwxr-xr-x 516 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#! /bin/sh

if [ $# -eq 0 ] ; then
	echo usage: do_fft.sh bin_file.dat result.png
	echo this script requires gnuplot, confft and bin_to_values.pl in the same path
	exit 1
fi

TEMP1=/tmp/__random__$$.dat
TEMP2=/tmp/__random__$$.fft

./bin_to_values.pl $1 > $TEMP1

(echo 0 ; confft -f $TEMP1 -m | tail -n +2) > $TEMP2

rm $TEMP1

gnuplot <<EOF > $2
set term png size 800,600
set autoscale
set title "FFT of $1"
set xlabel "freq"
set ylabel "magnitude
plot "$TEMP2" using 1 with lines title 'magnitude'
EOF

rm $TEMP2