필터 지우기
필터 지우기

Integral of another integral

조회 수: 1 (최근 30일)
carlos g
carlos g 2017년 5월 19일
댓글: Walter Roberson 2017년 5월 22일
I want to integrate h1b_eta and then plot it (m1b_eta). However, h1b_eta depends on other functions that also contain integrals. How can I do this?
h1b_eta=@(eta) blablabla and some integrals;
m1b_eta=@(eta) pi*(airy(2,eta)*integral(@(n) airy(n)*h1b_eta(n),eta_infts,eta)-airy(eta)*integral(@(n) airy(2,n)*h1b_eta(n),eta0ts,eta));
V1VEC=arrayfun(m1b_eta,0:0.01:N);
plot(abs(V1VEC),0:0.01:N)
I want to do this symbollically because I need to integrate m1b_eta aftwerwards (this can now be done numerically)
  댓글 수: 1
carlos g
carlos g 2017년 5월 22일
@Walter Roberson How can I use "result"? I am not that handy with symbolic functions. A is basically a variable (a number) and B is basically my variable eta, the same for GAMMA, that you defined

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

답변 (1개)

Walter Roberson
Walter Roberson 2017년 5월 19일
Code h1b_eta as a symbolic function; then
syms m1b_eta(eta) n
Pi = sym('pi');
m1b_eta(eta) = Pi * (airy(2,eta)*int(airy(n)*h1b_eta(n),n,eta_infts,eta) - airy(eta)*int( airy(2,n)*h1b_eta(n),n,eta0ts,eta));
x = 0:0.01:N;
V1VEC = m1b_eta(x);
plot(x, V1VEC)
Possibly the call will not be enough because it might have to turn the integral into numeric; you might need to use
V1VEC = arrayfun(@(ETA) double(m1b_eta(ETA)), x);
Also, if your expression is complicated, you might wan to use vpaintegral() instead of int() for performance: if you do, be sure to specify the RelTol option to get enough accuracy for your purpose.
  댓글 수: 4
carlos g
carlos g 2017년 5월 21일
편집: carlos g 2017년 5월 22일
@Walter Roberson How can I use "result"? I am not that handy with symbolic functions. A is basically a variable (a number) and B is basically my variable eta, the same for GAMMA, that you defined
Walter Roberson
Walter Roberson 2017년 5월 22일
V1s(eta)=((i*alpha1*lambda_0)^(-1/3))*q1*integral2(@(x, y) airy(y),...
eta01, eta, eta01, @(x) x);
V2s(eta)=((i*alpha2*lambda_0)^(-1/3))*q2*integral2(@(x, y) airy(y),...
eta02, eta, eta02, @(x) x);
comes out as
GAMMA=@(x) gamma(sym(x)); Pi = sym('pi');
V1s(eta) = (1/3)*(eta-eta01)*(-(3/4)*3^(1/6)*(hypergeom([2/3], [4/3, 5/3], (1/9)*x^3)*x^2-eta01^2*hypergeom([2/3], [4/3, 5/3], (1/9)*eta01^3))*GAMMA(2/3)^2+Pi*3^(1/3)*(x*hypergeom([1/3], [2/3, 4/3], (1/9)*x^3)-eta01*hypergeom([1/3], [2/3, 4/3], (1/9)*eta01^3)))*q1/((I*alpha1*lambda_0)^(1/3)*Pi*GAMMA(2/3));
V2s(eta) = (1/6)*(-2*3^(1/3)*eta02*Pi*(eta-(1/2)*eta02)*hypergeom([1/3], [4/3, 5/3], (1/9)*eta02^3)+(3/2)*GAMMA(2/3)^2*3^(1/6)*eta02^2*(eta-eta02)*hypergeom([2/3], [4/3, 5/3], (1/9)*eta02^3)-(1/20)*Pi*3^(1/3)*eta02^4*(eta-eta02)*hypergeom([4/3], [7/3, 8/3], (1/9)*eta02^3)+Pi*hypergeom([1/3], [4/3, 5/3], (1/9)*eta^3)*3^(1/3)*eta^2+3*GAMMA(2/3)^2*hypergeom([-1/3], [1/3, 2/3], (1/9)*eta^3)*3^(1/6)-3*GAMMA(2/3)^2*3^(1/6)*hypergeom([-1/3], [1/3, 2/3], (1/9)*eta02^3))*q2/((I*alpha2*lambda_0)^(1/3)*Pi*GAMMA(2/3));

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

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by