[Scilab-users] The 1st order Struve function

Claus Futtrup cfuttrup at gmail.com
Sat Jan 24 19:31:23 CET 2015


Hi

I've made a small script to play around with the first order Struve 
function. See bottom of this post.

I've already checked "help Struve" and also on the internet. There seems 
not to be any support for Struve functions in Scilab, is this correct?

Are you familiar with a better way than what I've done here? Please let 
me know. Thanks.

P.S. The input (x) must be non-zero ...

Best regards,
Claus

// struve_test.sce

function  z=H1(x)
     // The following expression approximates the 1st order Struve function H1
     // for each input x - the approximation follows Roald M. Aarts and
     // Augustus J. E. M. Janssen, Approximation of the Struve function H1
     // occuring in impedance calculations, J. Acoust. Soc. Am. 113 (5),
     // May 2003, page 2635 - 2637.
     // This is a simple and effective approximation of H1, valid for all input
     // x (real numbers only) unfortunately this source doesn't attempt to
     // approximate higher (or lower) orders of the Struve function.
     // The error in the approximation is less than 0.5% and at x near 0 the
     // error is 0.1% whereas for x ->  infinity, the error decays towards zero.
     // In acoustics x = 2ka, defines the iput frequency k = omega / c and size
     // of the piston radiator; a = sqrt(Sd/pi) = radius of the circular piston

     z  =  2/%pi  -  besselj(0,x)  +  (16/%pi  -  5)  .*  (sin(x)./x)  ..
               +  (12  -  36/%pi)  *  (  (1-cos(x))./(x.^2)  );
endfunction

x_array  =  0.1:0.1:50;  // define 500 points on the x-axis

z_1_array  =  H1(x_array);  // Calculate H1(x)

scf();
a  =  gca();
plot(x_array,z_1_array,'-r');
xtitle("Struve function","x (2ka)","output (z)");
legend("H1(x)");


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150124/31e611d1/attachment.htm>


More information about the users mailing list