Filter löschen
Filter löschen

Trouble evaluating integral where function is made of huge and tiny values

2 Ansichten (letzte 30 Tage)
supernoob
supernoob am 25 Feb. 2019
Bearbeitet: supernoob am 3 Mär. 2019
Hi there,
I'm trying to integrate a function which is the product of one tiny and one large value. Analytically, this makes the integrand work out but numerically I am running into problems. Say I have the following parameters:
ChiSq = @(x,y) a.*x.^2 + b.*x.*y + c ;
Chi = @(x,y) sqrt(a.*x.^2 + b.*x.*y + c );
n = 840; %degrees of freedom, a fixed number
a = 1e6;
b = -1.5e5;
c = 837; %a,b,c are parameters fit from experimental data
I plug these functions into the main function I want to integrate:
Zfun = @(x,y) (Chi(x,y).^(n/2-1)).*exp(-1/2*ChiSq(x,y));
The problem is, I can't integrate Zfun because Chi(x,y)^n/2-1 returns INF and exp(-1/2ChiSq) returns 0. If they could all be evaluated together the integrand would be reasonable, but due to numerical limitations this breaks.
How can I get around this?
UPDATE: I've tried the following but vpaintegral doesn't work with polar coordinates as far as I can tell. I'm confused about if the algorithm would integrate over a circular area if I transform into cartesian coordinates.
n = sym(840);
Zfun = @(x,y) (Chi(x,y).^(n/2-1)).*exp(-sym(1/2)*ChiSq(x,y));
polarZfun = @(theta,r) Zfun(r.*cos(theta),r.*sin(theta)).*r;
I(i) = vpaintegral(vpaintegral(polarZfun, theta, [0 2*pi]), r, [0 big_r]);
  4 Kommentare
supernoob
supernoob am 3 Mär. 2019
Bearbeitet: supernoob am 3 Mär. 2019
Walter, thanks for pointing out the typo, I fixed that, as well as put some example a,b values in. I have also simplified the integrand as there are some numerical factors I can account for later. As for integration limits: I transform the function into polar coordinates then integrate out to r=0.3 over all angles (I integrate over a circle in the polar plane). Is it possible to use sym() and vpaintegral to do this? I couldn't find any information on vpaintegral in polar coordinates.
supernoob
supernoob am 3 Mär. 2019
Are, thanks so much for your suggestions. Unfortunately I can't change the value of n as it is a real parameter in the experimental data. You comment gave me some food for thought, though. It's appreciated.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Interpolation of 2-D Selections in 3-D Grids finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by