How to get the integral expression?

조회 수: 2 (최근 30일)
Athira T Das
Athira T Das 2022년 12월 30일
댓글: Walter Roberson 2023년 1월 4일
I am trying to solve following expression in Matlab.
And my script is
clc;close all;clear all;
syms s phis r phir
A=1;m=1;n=1;L=100;alpha=1;
k=(2*pi)/(550*10^-9);
us=A*((-1j*sqrt(2*k*alpha)*s*exp(-1j*phis))^m)*exp(-k*alpha*s*s)*laguerreL(n,m,2*k*alpha*s*s);
C=((-1j*k*exp(1j*k*L))/(2*pi*L))*exp((1j*k*r*r)/(2*L));
f = @(s,phis,r,phir) C*s*us*exp(((1j*k)/(2*L))*(-2*r*s*cos(phir-phis)+(s^2)));
g = @(s,phis,r,phir) integral2(@(s,phis) f(s,phis,r,phir),0,Inf,0,2*pi)
g = function_handle with value:
@(s,phis,r,phir)integral2(@(s,phis)f(s,phis,r,phir),0,Inf,0,2*pi)
I need to get the final result as
How could I get the result like this?
  댓글 수: 3
Athira T Das
Athira T Das 2023년 1월 4일
Ok.
Then by doing integration in two steps like
clc;close all;clear all;
syms s phis r phir
A=1;m=1;n=1;L=100;alpha=1;
k=(2*pi)/(550*10^-9);
us=A*((-1j*sqrt(2*k*alpha)*s*exp(-1j*phis))^m)*exp(-k*alpha*s*s)*laguerreL(n,m,2*k*alpha*s*s);
C=((-1j*k*exp(1j*k*L))/(2*pi*L))*exp((1j*k*r*r)/(2*L));
f = @(s,phis,r,phir) C*s*us*exp(((1j*k)/(2*L))*(-2*r*s*cos(phir-phis)+(s^2)));
g1 = @(s,phis,r,phir) int(@(phis) f(s,phis,r,phir),0,2*pi)
g1 = function_handle with value:
@(s,phis,r,phir)int(@(phis)f(s,phis,r,phir),0,2*pi)
g2 = @(s,phis,r,phir) int(@(s) g1(s,r,phir),0,Inf)
g2 = function_handle with value:
@(s,phis,r,phir)int(@(s)g1(s,r,phir),0,Inf)
Still my problem is not solved. How to get the expression?
Walter Roberson
Walter Roberson 2023년 1월 4일
syms s phis r phir
Pi = sym(pi);
Q = @(v) sym(v);
A = Q(1); m = Q(1); n = Q(1); L = Q(100); alpha = Q(1);
k = (2*Pi)/(Q(550)*Q(10)^-9);
us = A*((-1j*sqrt(2*k*alpha)*s*exp(-1j*phis))^m)*exp(-k*alpha*s*s)*laguerreL(n,m,2*k*alpha*s*s);
C = ((-1j*k*exp(1j*k*L))/(2*Pi*L))*exp((1j*k*r*r)/(2*L));
f(s,phis,r,phir) = C*s*us*exp(((1j*k)/(2*L))*(-2*r*s*cos(phir-phis)+(s^2)));
g1(s,r,phir) = int(f(s,phis,r,phir), phis, 0,2*Pi, 'hold', true)
g2(r,phir) = int(g1(s,r,phir), s, 0, Inf, 'hold', true)
%decent speed up to this point. But the below is somewhat slow.
%and all it ends up doing is stripping the 'hold' status from the int()
G2 = release(g2)
If you are planning to go to a numeric function handle using integral(), then you can matlabFunction(g2) without having to release() . At least in the current version you can; my recollection is that in the previous release you could not do that.
The function generated by matlabFunction() looks like
@(r,phir)integral(@(s)integral(@(phis)sqrt(1.1e+1).*8.944271909999159e+3.*s.^2.*sqrt(pi).*exp(pi.*6.363636363636364e-1i).*exp(phis.*-1i).*exp(pi.*(s.^2-r.*s.*cos(phir-phis).*2.0).*1.818181818181818e+4i).*exp(r.^2.*pi.*1.818181818181818e+4i).*exp(s.^2.*pi.*(-3.636363636363636e+6)).*(s.^2.*pi.*7.272727272727273e+6-2.0).*(-1.652892561983471e+3),0.0,pi.*2.0),0.0,Inf)

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by