How to solve intergal for analytical form of ambiguity function
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
August Lamm
am 25 Jun. 2021
Bearbeitet: August Lamm
am 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.
Can someone please help with this?
regards
4 Kommentare
Walter Roberson
am 25 Jun. 2021
Run it under multiple conditions,
assume(imag(v) < 0)
Fim_neg = simplify(F)
assume(v, 'real')
Fim_zero = simplify(F)
assume(imag(v) > 0)
Fim_pos = simplify(F)
syms z %resets assumptions
Also, you might want to break it up into tau negative or tau positive
Akzeptierte Antwort
Paul
am 28 Jun. 2021
Bearbeitet: Paul
am 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)
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)
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.
3 Kommentare
Paul
am 28 Jun. 2021
I'm using the sinc() function in the Signal Processing Toolbox. It multiplies the argument by pi internally. Maybe you're using a different sinc() function, which could explain why you don't get the expected results in the plots? Check with which()
>> which sinc -all
C:\Program Files\MATLAB\R2019a\toolbox\signal\signal\sinc.m
C:\Program Files\MATLAB\R2019a\toolbox\symbolic\symbolic\@sym\sinc.m % sym method
C:\Program Files\MATLAB\R2019a\toolbox\signal\signal\@tall\sinc.m % tall method
The multiplication by (abs(tau) <= T) was to match the definition of X(tauv,v) in the Question that showed " = 0 elsewhere." I don't think there is a restriction on the ambiguity function, i.e, I think its domain covers -inf < tau < inf, but I could be wrong.
I'm not sure what you're seeing in the plots. When I run the code (in 2019a), here is what I get for Figure 7:
And Figure 8:
The Symbolic Math Toolbox can generate Latex expressions
doc latex
though in this forum I just run the code and the website does it automatically.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Number Theory finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!