Ltspice
From Attie's Wiki
Using a captured waveform as LTspice input
This outlines the steps necessary to use a CSV file as input for LTspice.
Capture your waveform
I have captured the following waveform using my scope, and saved it as a CSV file.
A sample of the CSV file is shown below:
x-axis,3,D0-D7 second,Volt, -1.0000000E-03,-48.2407212E-03,0 -999.8000E-06,-48.2407212E-03,0 -999.6000E-06,-48.2407212E-03,0 -999.4000E-06,-48.2407212E-03,0 - - - - - - - - >8 - - - - - - - - +8.9990000E-03,-168.8437350E-03,0 +8.9992000E-03,-176.8839359E-03,0 +8.9994000E-03,-48.2407212E-03,0 +8.9996000E-03,-48.2407212E-03,0
Convert the CSV file to a RAW 8-bit file
Use the following script below.
#!/bin/bash -e CSV_FILE=loaded.csv CSV_COLUMN=2 ROOT_FILENAME=$(echo ${CSV_FILE} | rev | cut -d . -f 2- | rev) # end of configuration cat ${CSV_FILE} \ | tail -n+3 \ | cut -d , -f ${CSV_COLUMN} \ | sed -r \ -e 's/^\+//' \ -e 's/^(-?[0-9]+\.[0-9]+)[eE]([+-])([0-9]+)$/\1*(10^\2\3)/' \ -e 's/\*\(10\^\+00\)$//' \ | bc -l \ | sed -re 's/^(-?)\./\10./' \ | tee .${CSV_FILE}.normal \ | sort -n \ | uniq \ > .${CSV_FILE}.sorted cat .${CSV_FILE}.sorted | sed -n "1p;$(wc -l .${CSV_FILE}.sorted | cut -d ' ' -f 1)p" > .${CSV_FILE}.extremes LO=$(cat .${CSV_FILE}.extremes | head -n 1) if [ $(echo "${LO} < 0" | bc) == "1" ]; then OP=- else OP=+ fi HI=$(echo "($(cat .${CSV_FILE}.extremes | tail -n 1))${OP}(${LO})" | bc -l) ML=$(echo "255/${HI}" | bc -l) cat .${CSV_FILE}.normal \ | sed -r \ -e 's/^/((/' \ -e 's/$/)/' \ -e "s/$/${OP}(${LO})/" \ -e "s/$/)*${ML}/" \ | bc -l \ | sed -r \ -e 's/^([0-9]*).([0-9]?[0-9]?[0-9]?).*$/\1.\2/' \ | tee .${CSV_FILE}.adjusted \ | awk '{printf "%c", strtonum($0)}' \ > ${ROOT_FILENAME}.raw