How to get the integral expression?

2 Ansichten (letzte 30 Tage)
Athira T Das
Athira T Das am 30 Dez. 2022
Kommentiert: Walter Roberson am 4 Jan. 2023
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 Kommentare
Athira T Das
Athira T Das am 4 Jan. 2023
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 am 4 Jan. 2023
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)

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by