# How can I write "StruveL function" in matlab?

4 visualizzazioni (ultimi 30 giorni)
Shreen El-Sapa il 9 Dic 2023
Commentato: Walter Roberson il 10 Dic 2023
How can I write "StruveL function" in matlab?
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

David Goodmanson il 9 Dic 2023
Hello Shreen,
Here are two ways although you will need the symbolics toolbox for the first one. I used benign values for z and nu and the two methods agree very closely. When either z or nu get excessively large there will be numerical issues, and you might explore to see which method gives up first.
nu = 1.2;
z = 0:.1:4;
% hypergeometic function 1F2
C = 2/(sqrt(pi)*gamma(nu+3/2));
L1 = C*(z/2).^(nu+1).*hypergeom(1,[3/2+nu,3/2],z.^2/4)
% numerical integration
D = 2/(sqrt(pi)*gamma(nu+1/2));
fun = @(th,z,nu) sinh(z*cos(th)).*sin(th).^(2*nu);
L2 = D*(z/2).^nu.*integral(@(th) fun(th,z,nu),0,pi/2,'arrayvalued',true);
checkdel = max(abs(L1-L2))
L1 =
Columns 1 through 9
0 0.0010 0.0046 0.0113 0.0214 0.0351 0.0528 0.0748 0.1012
Columns 10 through 18
0.1325 0.1691 0.2112 0.2594 0.3141 0.3758 0.4452 0.5228 0.6095
Columns 19 through 27
0.7059 0.8129 0.9316 1.0629 1.2080 1.3682 1.5449 1.7396 1.9540
Columns 28 through 36
2.1901 2.4498 2.7355 3.0496 3.3948 3.7742 4.1911 4.6491 5.1522
Columns 37 through 41
5.7048 6.3118 6.9783 7.7104 8.5143
checkdel =
3.5527e-15
ans = 3.5527e-15
##### 3 CommentiMostra 1 commento meno recenteNascondi 1 commento meno recente
Shreen El-Sapa il 9 Dic 2023
Because I used them inside other calculations to plot other functions. Are you understand me?
Walter Roberson il 10 Dic 2023
Pi = sym(pi);
syms z
nu0 = sym(0);
C0 = 2/(sqrt(Pi)*gamma(nu0+3/2));
L0 = C0*(z/2).^(nu0+1).*hypergeom(1,[3/2+nu0,3/2],z.^2/4)
L0 =
nu1 = sym(1);
C1 = 2/(sqrt(Pi)*gamma(nu1+3/2));
L1 = C1*(z/2).^(nu1+1).*hypergeom(1,[3/2+nu1,3/2],z.^2/4)
L1 =

Accedi per commentare.

### Categorie

Scopri di più su Conversion Between Symbolic and Numeric in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by