dblquad: double integral problems

2 views (last 30 days)
Hello all!
Could you please help me with this piece of code?
f = 300e6;
omega = 2*pi*f;
lambda = 3e8/f;
k = 2*pi/lambda;
l = 2*lambda;
h = l/2;
a = 0.005*lambda;
mu0 = 4*pi*1e-7;
epsilon0 = 8.85e-12;
N = 101;
dz = l/(N + 1);
The first function:
% The integrated function g_int
function [out] = g_int(phi, ksi, z, a, k)
for i = 1:(size(ksi,2))
R = sqrt((2*a*sin(phi(i)))^2 + (z - ksi(i))^2);
out(i) = 1/(2*pi)*exp(-1i*k*R)/(4*pi*R);
end
end
Then,
for i = 1:(N + 1)
z = i*dz;
psi(i + 1) = dblquad('g_int', 0, 2*pi, -dz/2, +dz/2, 1e-5, 0, z, a, k);
end
Any ideas?
Thanks,
Kate

Accepted Answer

Walter Roberson
Walter Roberson on 23 Nov 2012
You did not describe the problem you encountered.
If your function g_int is not in its own g_int.m file, then you need to change the 'g_int' argument in the dblquad() call to be @g_int

More Answers (0)

Categories

Find more on Characters and Strings in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!