Double integral with singularity

2 views (last 30 days)
Hi, I want to integrate the following equation (singularity at t = \tau)
1./sqrt(4*pi*(t-\tau)).*exp(-(x - \xi).^2./(4*(t-\tau)));
space x = (-10 <= x <= 10), time t = (0 <= t <= 2.1)
variable of integration \xi, \tau
\xi = x, 0 < \tau < t
So I tried as following code.
x = linspace(-10, 10, 41);
t = linspace(0.1, 2.1, 41);
xi = x;
ta = t;
nx = length(x); % number of interval of x
nt = length(t); % number of interval of t
for mt = 1:nt
for mx = 1:nx
GLA = @(ta, xi) 1./sqrt(4*pi*(t(mt)-ta)).*exp(-(x(mx) - xi).^2 ...
./(4*(t(mt)-ta)));
funGLA = quad2d(GLA, 0.05, ta(mt), xi(1), xi(end));
Int_GLA(mt, mx) = funGA;
end
end
However, it leads to wrong results. I don't know what's wrong. Could you help me?
  6 Comments
Teja Muppirala
Teja Muppirala on 11 Jan 2013
Just checking, but you wrote two different variable names "funGLA" and "funGA".
funGLA = quad2d(GLA, 0.05, ta(mt), xi(1), xi(end));
Int_GLA(mt, mx) = funGA; <--------
Could that possibly be your problem?

Sign in to comment.

Accepted Answer

Teja Muppirala
Teja Muppirala on 11 Jan 2013
I will change my earlier comment into an answer:
Look at these two lines:
funGLA = quad2d(GLA, 0.05, ta(mt), xi(1), xi(end));
Int_GLA(mt, mx) = funGA;
You are calculating funGLA but then you are saying Int_GLA(mt,mx) = funGA
funGA is a variable remaining from an earlier calculation, and so every value of Int_GLA is getting assigned to that same number. You should first correct that mistake, and then see if that helps anything.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!