From cd4877b4fe16ba343d59c36b1280392e6b9a088d Mon Sep 17 00:00:00 2001 From: Laurent Belcour Date: Tue, 26 Mar 2013 16:47:31 +0100 Subject: [PATCH] Adding an example of a ABC function. --- sources/matlab/ABC.m | 10 ++++++++++ sources/matlab/testABC.m | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 sources/matlab/ABC.m create mode 100644 sources/matlab/testABC.m diff --git a/sources/matlab/ABC.m b/sources/matlab/ABC.m new file mode 100644 index 0000000..c7cbc0b --- /dev/null +++ b/sources/matlab/ABC.m @@ -0,0 +1,10 @@ +function rho = ABS(theta_in, phi_in, theta_out, phi_out, a, b, c) + + fx = sin(theta_out)*cos(phi_out) - sin(theta_in); + fy = sin(theta_out)*sin(phi_out); + f = sqrt(fx*fx + fy*fy); + + psd = a / (1+b*b * f*f)^(c); + rho = 4*pi*pi * (cos(theta_in)+cos(theta_out))^2 * psd; + +endfunction diff --git a/sources/matlab/testABC.m b/sources/matlab/testABC.m new file mode 100644 index 0000000..ea4dfda --- /dev/null +++ b/sources/matlab/testABC.m @@ -0,0 +1,18 @@ +theta = -0.5*pi:0.01:0.5*pi; + +a = 1; b =10; c=1.5; +cost = cos(theta); +sint = sin(theta); +f = sint; + +psd = a ./ (1 + b*b * f.*f).^(0.5*(c+1)) ; + +rho = cost.^2 .* psd ; + +Frho = fftshift(fft(rho)) / max(size(rho)); +Prho = sqrt(Frho .* conj(Frho)); + + +figure(1); plot(rho); +figure(2); plot(Prho); +figure(3); plot(imag(Frho) ./ real(Frho)); -- 2.26.2