How to Calculate the Ambiguity Function (Maybe this should be on Stackoverflow instead ...)

What is the best way to calculate the ambiguity function? There are different implementations out there for Python (like PyTFTB or from TooringAnalytics) and Matlab but there are many difficulties:

1. Python - PyTFTB

I am not sure whether the implementation of pytftb is what I am looking for because the plots for 200 Samples of my data always look similar. Here are two examples:






I'd expect more distinct plots. The plots were generated like this:

from tftb.processing import ambiguity
waf, tau, theta = ambiguity.wide_band(signal)
cntr = plt.contourf(tau, theta, np.abs(waf) ** 2, cmap="Greys", antialiased=True)
// even less difference when I use np.abs(waf) ** 2
plt.imsave("filename.jpg", np.abs(waf), cmap="jet")


2. Python - TooringAnalytics

Unfortunately I can't make this one work. Maybe this is content for another question.

3. Matlab

Is not an option. I tried my best to translate this to R but couldn't make it work.

4. R

Unfortunately I couldn't find an implementation yet in R.

I'd really like to ask Dreamcooled how he computed his ambiguity function.

Thanks for your help
Octave is a free mostly MATLAB compatible application. You shouldn’t rule it out. Also, your signals would look more alike if you removed the low frequency trend obvious in both plots. You may have a valid ambiguity function although I think you may be calculating an ambiguity on signal plus noise not the proper calculation of just signal.

There is more than one ambiguity function, this is the wide band single transmitter single receiver version. Most people think Doppler is just a frequency shift but it is actually a time dilation, although the frequency shift model is very often sufficient, particularly when looking at steady lines like molecular emission lines. 

In acoustics the motion of the propagation media can also cause Doppler.

This code should be ok as long as the interpolation is accurate, which assumes that the signal has sample more than about 5 points per cycle.

 % wide band ambiguity function
    clc
    clear all
    close all
    %
    tb=-1;
    tend=1;
    dialation=.8;
    %
    %signal=[zeros(1,100) randn(1,200) zeros(1,100)];
    %signal=[zeros(1,100) exp(1j*2*pi*(4*[0:199]/200)) zeros(1,100)];
    signal=[zeros(1,100) exp(1j*2*pi*(4*[0:199]+.01*[0:199].^2)/200) zeros(1,100)];
    conj_rev_signal=conj(signal(end:-1:1));
    time=linspace(tb,tend,length(signal));
    delay_time=linspace(2*tb,2*tend,2*length(signal)-1);
    tau=linspace(dialation,1/dialation,512);
    out=zeros(length(tau),2*length(signal)-1);
    for i=1:length(tau)
    out(i,:)=conv(signal,interp1(time,conj_rev_signal,time*tau(i),'spline'));
    end
    figure(1)
    imagesc(delay_time,tau,abs(out))