# How to solve intergal for analytical form of ambiguity function

2 views (last 30 days)
August Lamm on 25 Jun 2021
Edited: August Lamm on 29 Jun 2021
Hi,
I am new to this subject and I need some advice or hint to solve the following problem. I have to develop a matlab program were I determine the analytical form of the ambiguity function with an rectangualr pulse, like in the picture.
My little program looks like this
syms t T v tau
assume(abs(tau) <= T)
func = rectangularPulse(t)*rectangularPulse(t-tau)*exp(2i*pi*v*t);
F = int(func,t,-inf,inf)
where I put all together, but the solution is
F =
piecewise((imag(v) < 0 & ~0 < v*1i | 0 < imag(v)) & tau == 0, (exp(-pi*v*1i)*1i)/(2*v*pi) - (exp(pi*v*1i)*1i)/(2*v*pi), (1 <= tau | tau <= -1) & (imag(v) < 0 & ~0 < v*1i | 0 < imag(v)), 0, (imag(v) < 0 & ~0 < v*1i | 0 < imag(v)) & tau in Dom::Interval([0], [1]), (exp(pi*v*(tau - 1/2)*2i)*1i)/(2*v*pi) - (exp(pi*v*1i)*1i)/(2*v*pi), (imag(v) < 0 & ~0 < v*1i | 0 < imag(v)) & tau in Dom::Interval([-1], [0]), - (exp(pi*v*(tau + 1/2)*2i)*1i)/(2*v*pi) + (exp(-pi*v*1i)*1i)/(2*v*pi), (0 <= imag(v) | ~0 < v*1i) & imag(v) <= 0 & (imag(v) < 0 & ~0 < v*1i | 0 < imag(v)) & (0 <= imag(v) | 0 < v*1i) & 1 <= tau, int(exp(pi*t*v*2i), t, piecewise(0 <= tau, tau + 1/2, tau <= 0, 1/2), Inf) + int(-exp(pi*t*v*2i), t, piecewise(-1 <= tau, tau + 1/2, tau <= -1, -1/2), Inf), (0 <= imag(v) | ~0 < v*1i) & imag(v) <= 0 & (imag(v) < 0 & ~0 < v*1i | 0 < imag(v)) & (0 <= imag(v) | 0 < v*1i) & tau <= -1, int(exp(pi*t*v*2i), t, piecewise(0 <= tau, tau - 1/2, tau <= 0, -1/2), Inf) + int(-exp(pi*t*v*2i), t, piecewise(1 <= tau, tau - 1/2, tau <= 1, 1/2), Inf) - (exp(-pi*v*1i)*1i)/(2*v*pi) + (exp(pi*v*1i)*1i)/(2*v*pi), (0 <= imag(v) | ~0 < v*1i) & imag(v) <= 0 & (imag(v) <= 0 | 0 < tau) & (imag(v) < 0 & ~0 < v*1i | 0 < imag(v)) & (0 <= imag(v) | 0 < v*1i) & tau in Dom::Interval([0], [1]) & (0 <= imag(v) | 0 < v*1i | 0 < tau) & (0 <= imag(v) | ~0 < v*1i | 0 < tau), int(exp(pi*t*v*2i), t, piecewise(0 <= tau, tau + 1/2, tau <= 0, 1/2), Inf) + int(-exp(pi*t*v*2i), t, piecewise(-1 <= tau, tau + 1/2, tau <= -1, -1/2), Inf) + (exp(pi*v*(tau - 1/2)*2i)*1i)/(2*v*pi) - (exp(pi*v*1i)*1i)/(2*v*pi), (0 <= imag(v) | ~0 < v*1i) & imag(v) <= 0 & (imag(v) <= 0 | tau < 0) & (imag(v) < 0 & ~0 < v*1i | 0 < imag(v)) & (0 <= imag(v) | 0 < v*1i) & tau in Dom::Interval([-1], [0]) & (0 <= imag(v) | 0 < v*1i | tau < 0) & (0 <= imag(v) | ~0 < v*1i | tau < 0), int(exp(pi*t*v*2i), t, piecewise(0 <= tau, tau - 1/2, tau <= 0, -1/2), Inf) + int(-exp(pi*t*v*2i), t, piecewise(1 <= tau, tau - 1/2, tau <= 1, 1/2), Inf) - (exp(pi*v*(tau + 1/2)*2i)*1i)/(2*v*pi) + (exp(pi*v*1i)*1i)/(2*v*pi), (0 <= imag(v) | ~0 < v*1i) & imag(v) <= 0 & (imag(v) <= 0 | 0 < tau) & (imag(v) <= 0 | 1 < tau) & (imag(v) <= 0 | tau < 1) & (imag(v) < 0 & ~0 < v*1i | 0 < imag(v)) & (0 <= imag(v) | 0 < v*1i) & 0 <= tau & (0 <= imag(v) | 0 < v*1i | 0 < tau) & (0 <= imag(v) | 0 < v*1i | 1 < tau) & (0 <= imag(v) | 0 < v*1i | tau < 1) & (0 <= imag(v) | ~0 < v*1i | 0 < tau) & (0 <= imag(v) | ~0 < v*1i | 1 < tau) & (0 <= imag(v) | ~0 < v*1i | tau < 1), int(exp(pi*t*v*2i), t, piecewise(0 <= tau, tau - 1/2, tau <= 0, -1/2), Inf) + int(-exp(pi*t*v*2i), t, piecewise(1 <= tau, tau - 1/2, tau <= 1, 1/2), Inf), (0 <= imag(v) | ~0 < v*1i) & imag(v) <= 0 & (imag(v) <= 0 | tau < 0) & (imag(v) <= 0 | -1 < tau) & (imag(v) <= 0 | tau < -1) & (imag(v) < 0 & ~0 < v*1i | 0 < imag(v)) & (0 <= imag(v) | 0 < v*1i) & tau <= 0 & (0 <= imag(v) | 0 < v*1i | tau < 0) & (0 <= imag(v) | 0 < v*1i | -1 < tau) & (0 <= imag(v) | 0 < v*1i | tau < -1) & (0 <= imag(v) | ~0 < v*1i | tau < 0) & (0 <= imag(v) | ~0 < v*1i | -1 < tau) & (0 <= imag(v) | ~0 < v*1i | tau < -1), int(exp(pi*t*v*2i), t, piecewise(0 <= tau, tau + 1/2, tau <= 0, 1/2), Inf) + int(-exp(pi*t*v*2i), t, piecewise(-1 <= tau, tau + 1/2, tau <= -1, -1/2), Inf) + (exp(-pi*v*1i)*1i)/(2*v*pi) - (exp(pi*v*1i)*1i)/(2*v*pi), (imag(v) <= 0 | 0 < tau) & (imag(v) <= 0 | tau < 0) & (imag(v) <= 0 | -1 < tau) & (imag(v) <= 0 | 1 < tau) & (imag(v) <= 0 | tau < -1) & (imag(v) <= 0 | tau < 1) & in(tau, 'real') & (0 <= imag(v) | 0 < v*1i | 0 < tau) & (0 <= imag(v) | 0 < v*1i | tau < 0) & (0 <= imag(v) | 0 < v*1i | -1 < tau) & (0 <= imag(v) | 0 < v*1i | 1 < tau) & (0 <= imag(v) | 0 < v*1i | tau < -1) & (0 <= imag(v) | 0 < v*1i | tau < 1) & (0 <= imag(v) | ~0 < v*1i | 0 < tau) & (0 <= imag(v) | ~0 < v*1i | tau < 0) & (0 <= imag(v) | ~0 < v*1i | -1 < tau) & (0 <= imag(v) | ~0 < v*1i | 1 < tau) & (0 <= imag(v) | ~0 < v*1i | tau < -1) & (0 <= imag(v) | ~0 < v*1i | tau < 1), int(exp(pi*t*v*2i), t, piecewise(0 <= tau, tau - 1/2, tau <= 0, -1/2), Inf) + int(exp(pi*t*v*2i), t, piecewise(0 <= tau, tau + 1/2, tau <= 0, 1/2), Inf) + int(-exp(pi*t*v*2i), t, piecewise(-1 <= tau, tau + 1/2, tau <= -1, -1/2), Inf) + int(-exp(pi*t*v*2i), t, piecewise(1 <= tau, tau - 1/2, tau <= 1, 1/2), Inf))
and I don't understand what's exactly going on here. To me this seems that there are different solutions for a different constraints of tau, right? But in F I've not found the solution given in the picture above.
regards
August Lamm on 28 Jun 2021
I've tried this way, but could not get the wanted result out of it.
cheers

Paul on 28 Jun 2021
Edited: Paul on 28 Jun 2021
I was not able to get Matlab to return a solution in the expected form of the answer. But we can show that Matlab's solution is the same as the expected result.
syms t tau v w T real
s(t) = rectangularPulse(-T/2,T/2,t)/sqrt(T);
Note that the ambiguity function is essentially the inverse Fourier transform of s(t)*s(t-tau) with t and w reversed.
F1(tau,w,T) = ifourier(s(t)*s(t-tau),t,w)*2*sym(pi); % simpler form?
F1(tau,v,T) = F1(tau,2*sym(pi)*v,T)
F1(tau, v, T) =
Compute the ambiguity function with the defining integral.
F2(tau,v,T) = int(s(t)*s(t-tau)*exp(1j*2*sym(pi)*v*t),t,-T,T) % only need to integrate from outside the limits of s(t)
F2(tau, v, T) =
Ambiguity function as defined in the question.
F3 = @(tau,v,T) (exp(1j*pi.*v.*tau).*(1-abs(tau)./T).*sinc(v.*(T-abs(tau))).*(abs(tau)<=T)); % expected answer
Evaluate and compare all three for T = 1.
Tval = 1;
tauvec = -1.5:.1:1.5;
vvec = -5:.1:5;
vvec(vvec==0) = NaN; % avoid divide by 0 in F1 and F2
[Tau,V] = meshgrid(tauvec,vvec);
F1val = double(vpa(F1(Tau,V,Tval)));
F2val = double(vpa(F2(Tau,V,Tval)));
F3val = double((F3(Tau,V,Tval)));
figure
surf(Tau,V,abs(F1val));xlabel('tau');ylabel('v');
figure
surf(Tau,V,abs(F2val));xlabel('tau');ylabel('v');
figure
surf(Tau,V,abs(F3val));xlabel('tau');ylabel('v');
figure
surf(Tau,V,angle(F1val));xlabel('tau');ylabel('v');
figure
surf(Tau,V,angle(F2val));xlabel('tau');ylabel('v');
figure
surf(Tau,V,angle(F3val));xlabel('tau');ylabel('v');
figure
surf(Tau,V,abs(F1val - F2val));xlabel('tau');ylabel('v');
figure
surf(Tau,V,abs(F1val - F3val));xlabel('tau');ylabel('v');
figure
surf(Tau,V,abs(F2val - F3val));xlabel('tau');ylabel('v');
Code took too long to run; the figures aren't shown.
August Lamm on 28 Jun 2021
Your guess was right. I added a pi to the argument of the sinc function udn that gave me the wrong plot. Now, after removing the pi I also have the same plot as you.

R2021a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!