## Saturday, 24 December 2016

### Gnuplot/C Update

A new version of Gnuplot/C has been uploaded to SourceForge that includes polar plotting capabiliites : https://sourceforge.net/projects/gnuplotc/.

This adds to the existing plot types :
Line Plot
XY Plot
Pole-Zero Plot
Spectrogram Plot
Image Plot

If you have found this solution useful then please do hit the Google (+1) button so that others may be able to find it as well.
Numerix-DSP Libraries : http://www.numerix-dsp.com/eval/

## Thursday, 22 December 2016

### Polar plot in Gnuplot

I was recently playing with microphone array polar diversity responses and did a search for suitable Gnuplot polar plot solutions. There are a number that turned up but none of them really matched my requirement so here it is :

set polar
set angle degree
set size ratio 1
set tmargin 3
set bmargin 3
set title "Microphone Polar Diversity Response : Mic Spacing 0.1 (meters)"
set key out vert nobox

set style line 1 lc rgb 'gray80' lt -1
set grid polar ls 1

unset border
unset xtics
unset ytics

f_maxGain=0.                                    # Maximum gain - MUST BE FLOATING POINT
minGain=-80                                     # Minimum gain - MUST BE INTEGER
tickstep = 10                                   # Ticks every 10 dB
numticks = 8                                    # numticks = r / tickstep :: Don't use divide because numticks is used in for loop and doesn't work
f_numticks = 8.                                 # Floating point numticks

set rrange [minGain:0]
set rtics tickstep format '' scale 0

set label '0°' center at first 0, first -minGain*1.05
set label '90°' right at first -minGain*1.05, 0
set label '180°' center at first 0, first minGain*1.05
set label '270°' left at first minGain*1.05, 0

set for [i=.1:numticks] label at first minGain*0.001, first minGain*((i/f_numticks) + 0.007) sprintf("%d dB", minGain+(i*10))
unset raxis

plot "250.dat" u (-$1+90.):($2-f_maxGain) t "250 Hz" w lines lc rgb "magenta", \
"500.dat" u (-$1+90.):($2-f_maxGain) t "500 Hz" w lines lc rgb "red", \
"1000.dat" u (-$1+90.):($2-f_maxGain) t "1000 Hz" w lines lc rgb "blue", \
"2000.dat" u (-$1+90.):($2-f_maxGain) t "2000 Hz" w lines lc rgb "cyan", \
"4000.dat" u (-$1+90.):($2-f_maxGain) t "4000 Hz" w lines lc rgb "orange"

print "Hit <CR> to continue ..."
pause -1

The data was generated in a C program and written to the .dat files, then I just used gnuplot on the command line to execute the script and plot the results.

The data files look like this (i.e. two columns : angle and gain) :

# Antenna Beam Pattern
# Angle Gain
-9.00e+01 -1.17e+00
-8.90e+01 -1.17e+00
-8.80e+01 -1.17e+00
.
.

Here is the plot for 100 mm mic spacing :

The gnuplot script allows the min and max gain values to be changed.

If you have found this solution useful then please do hit the Google (+1) button so that others may be able to find it as well.
Numerix-DSP Libraries : http://www.numerix-dsp.com/eval/

## Sunday, 9 October 2016

### DSP Tech Brief : FIR Filter Design Notes

When designing an FIR filter it is handy to know how many coefficients are required for your desired implementation.

The Kaiser approximation is the algorithm that tells you how many coefficients your filter will need but not what those coefficients are. It is accurate when using an approximation design algorithm such as the Parks-McClellan (Remez exchange) algorithm.

For designing filters with the windowing functions there are no direct equivalents to Kaiser's approximation, it is more that you have to look at the characteristics of your signal requirements and compare them to the capabilities of the windowing functions. Note : filters designed using windowing functions will typically be longer than those designed using Parks-McClellan.

SigLib includes a range of windows based filter design functions. At the present time it does not include a version of the Parks-McClellan algorithm because there are so many already available. I had a customer recently use this : http://www.iowahills.com/Example%20Code/NewParksMcClellan.txt.

I haven't used this myself but I have heard good reports.

If you have found this solution useful then please do hit the Google (+1) button so that others may be able to find it as well.
Numerix-DSP Libraries : http://www.numerix-dsp.com/eval/

## Monday, 4 July 2016

### Updated Numerix Host Library

The Numerix Host Library is a library of C/C++ functions that can be used to write DSP data to files for debugging, logging and exchange between different applications such as SigLib, Matlab, Octave, Open Office, Libre Office, Excel, Python and others.

It currently supports .bin .csv, ,dat (gnuplot), .sig (SigLib), XMOS .xmt and .wav file formats.

If you have found this solution useful then please do hit the Google (+1) button so that others may be able to find it as well.
Numerix-DSP Libraries : http://www.numerix-dsp.com/eval/

## Friday, 3 June 2016

### DSP Tech Brief : Frequency Domain Convolution And Filtering

Performing convolution and filtering in the frequency domain is a useful method of increasing the performance of these functions by using the fact that convolution in the time domain is equivalent to multiplication in the frequency domain.

The down side is that there is increased end-to-end latency due to the requirement to translate between the time and frequency domains (and back again).

Two common methods of performing this task are the Overlap And Add or the Overlap And Save.

These algorithms are summarized in the following document : http://www.numerix-dsp.com/tutorials/DSP/FrequencyDomainFiltering.pdf

Some notes to accompany the presentation :
Looking at the diagrams, lets assign the filter input to Input A and the streaming data to Input B.
The FFT for the filter input can be pre-calculated to reduce the run-time overhead.
The filter length is defined by the system level requirements - pass band ripple, stop band attenuation, transition bandwidth. From this you can then work out what FFT length (> length N+M-1) you require, what dataset length you can support (Input B) and then what overlap you need to use for the FFT algorithms.

If you use Decimation In Frequency algorithms for the forward and inverse FFTs then you can avoid the need to bit reverse re-order the data because all of the frequency domain data will be in bit reversed order.

When using an FFT for an application such as spectrum analysis it is often necessary to window the time domain data to reduce spectral leakage. This is not necessary for the overlap algorithms because the spectral leakage is a linear (convolution) operation caused by the discrete nature of the forward FFT. When you perform the inverse FFT the process is reversed and hence the effect is cancelled

If you have found this solution useful then please do hit the Google (+1) button so that others may be able to find it as well.
Numerix-DSP Libraries : http://www.numerix-dsp.com/eval/

## Sunday, 3 January 2016

### VMWare Virtual Machine Notes

I need somewhere to store my notes so this seems to be as good a place as any.

How To Remove Old Ubuntu Kernel Packages
Stolen from my Brother here : https://edwards.sdsu.edu/research/ubuntu-clean-boot-partition/#more-1599

First, figure out which running kernel you have:
uname -r
Do NOT remove that kernel!

Figure out which kernels you have installed
dpkg -l | grep linux-image | grep ii
Then remove them:
apt-get autoremove <package 1> <package 2>

Shrinking Virtual Machines To Use Less Disk Space
In virtual machine :
sudo apt-get -y autoremove
sudo apt-get clean
cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill