MATLAB Answers

How to solve intergal for analytical form of ambiguity function

조회 수: 2(최근 30일)
August Lamm
August Lamm 2021년 6월 25일
편집: August Lamm 2021년 6월 29일
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
August Lamm
August Lamm 2021년 6월 28일
I've tried this way, but could not get the wanted result out of it.
cheers

댓글을 달려면 로그인하십시오.

채택된 답변

Paul
Paul 2021년 6월 28일
편집: Paul 2021년 6월 28일
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.
  댓글 수: 3
August Lamm
August Lamm 2021년 6월 28일
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.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by