Guest User

Untitled

a guest
Jun 7th, 2018
166
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Get signal level using rtl_power_fftw - very long - LamaBleu
  2. Resulting plot : https://imgur.com/45sn6wG
  3.  
  4. 2 files : level-fftw.sh levels.gnu
  5.  
  6. ##############################################
  7.  
  8. level-fftw.sh : (start 98Mhz, stop 108 MHz, step 25kHz)
  9. ================
  10.  
  11. #!/bin/bash
  12. rm levels.csv; touch levels.csv
  13. stepper_start_int=98000000
  14. stepper_stop_int=108000000
  15. stepper_hop_dec=0.2
  16. stepper_step_int=25000
  17. i=$((stepper_start_int))
  18. end=$(($stepper_stop_int))
  19.  
  20. while [ $i -le $end ]; do
  21. FFTW_MES=$(rtl_power_fftw -f $i -g 450 -b 32 | grep -A17 'frequency' | tail -1 ) >&-
  22. #sleep 0.1
  23. LEVEL=$(echo $FFTW_MES | awk '{print $2}')
  24. echo "Freq: " $i " Level : " $LEVEL
  25. echo $FFTW_MES >> levels.csv
  26. i=$(($i+$stepper_step_int))
  27. LEVEL=""
  28. FFTW_MES=""
  29. done
  30. echo "Stepper end. "
  31. echo "Drawing plot ..."
  32. gnuplot -persist -e "fmax=$i;f0=$stepper_start_int" ./levels.gnu
  33.  
  34. ########################################################################
  35.  
  36. levels.gnu :
  37. ============
  38.  
  39. set term qt 0
  40. set title "From " . sprintf("%8.3f", f0/1000000) . " MHz to " . sprintf("%8.3f", fmax/1000000) . " MHz"
  41. set xlabel "freq. [MHz]"
  42. set xrange [f0/1000000:fmax/1000000]
  43. set yrange [-60:-20]
  44. set ylabel "Signal level [dB] (relative)"
  45. set origin 20,20
  46. set format x "%1.0f"
  47. set size 0.95,0.95
  48. set key at graph 0.95, 0.9
  49. set origin 0.0,0.0
  50. plot "levels.csv" using ($1)/1000000:($2) with lines lc rgb '#ff4500' title " "
  51. replot
  52. pause 10
RAW Paste Data