<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi<br>
<br>
I've made a small script to play around with the first order Struve
function. See bottom of this post.<br>
<br>
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?<br>
<br>
Are you familiar with a better way than what I've done here? Please
let me know. Thanks.<br>
<br>
P.S. The input (x) must be non-zero ...<br>
<br>
Best regards,<br>
Claus<br>
<br>
<pre style="font-family:Monospaced;font-style:normal;font-size:12.0;"><span style="color:rgb(100,174,100);font-style:italic;">// struve_test.sce</span>
<span style="color:rgb(176,24,19);">function</span> <span style="color:rgb(131,67,16);font-weight:bold;">z</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(0,0,0);text-decoration:underline;">H1</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">x</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(100,174,100);font-style:italic;">// The following expression approximates the 1st order Struve function H1</span>
<span style="color:rgb(100,174,100);font-style:italic;">// for each input x - the approximation follows Roald M. Aarts and</span>
<span style="color:rgb(100,174,100);font-style:italic;">// Augustus J. E. M. Janssen, Approximation of the Struve function H1</span>
<span style="color:rgb(100,174,100);font-style:italic;">// occuring in impedance calculations, J. Acoust. Soc. Am. 113 (5),</span>
<span style="color:rgb(100,174,100);font-style:italic;">// May 2003, page 2635 - 2637.</span>
<span style="color:rgb(100,174,100);font-style:italic;">// This is a simple and effective approximation of H1, valid for all input</span>
<span style="color:rgb(100,174,100);font-style:italic;">// x (real numbers only) unfortunately this source doesn</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">t attempt to</span>
<span style="color:rgb(100,174,100);font-style:italic;">// approximate higher (or lower) orders of the Struve function.</span>
<span style="color:rgb(100,174,100);font-style:italic;">// The error in the approximation is less than 0.5% and at x near 0 the</span>
<span style="color:rgb(100,174,100);font-style:italic;">// error is 0.1% whereas for x -</span><span style="color:rgb(100,174,100);font-style:italic;">></span><span style="color:rgb(100,174,100);font-style:italic;"> infinity, the error decays towards zero.</span>
<span style="color:rgb(100,174,100);font-style:italic;">// In acoustics x = 2ka, defines the iput frequency k = omega / c and size</span>
<span style="color:rgb(100,174,100);font-style:italic;">// of the piston radiator; a = sqrt(Sd/pi) = radius of the circular piston</span>
<span style="color:rgb(131,67,16);font-weight:bold;">z</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">2</span><span style="color:rgb(92,92,92);">/</span><span style="color:rgb(218,112,214);">%pi</span> <span style="color:rgb(92,92,92);">-</span> <span style="color:rgb(50,185,185);">besselj</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">0</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(131,67,16);font-weight:bold;">x</span><span style="color:rgb(74,85,219);">)</span> <span style="color:rgb(92,92,92);">+</span> <span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">16</span><span style="color:rgb(92,92,92);">/</span><span style="color:rgb(218,112,214);">%pi</span> <span style="color:rgb(92,92,92);">-</span> <span style="color:rgb(188,143,143);">5</span><span style="color:rgb(74,85,219);">)</span> <span style="color:rgb(92,92,92);">.*</span> <span style
="color:rgb(74,85,219);">(</span><span style="color:rgb(50,185,185);">sin</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">x</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">./</span><span style="color:rgb(131,67,16);font-weight:bold;">x</span><span style="color:rgb(74,85,219);">)</span> <span style="color:rgb(255,170,0);">..</span>
<span style="color:rgb(92,92,92);">+</span> <span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">12</span> <span style="color:rgb(92,92,92);">-</span> <span style="color:rgb(188,143,143);">36</span><span style="color:rgb(92,92,92);">/</span><span style="color:rgb(218,112,214);">%pi</span><span style="color:rgb(74,85,219);">)</span> <span style="color:rgb(92,92,92);">*</span> <span style="color:rgb(74,85,219);">(</span> <span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(50,185,185);">cos</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">x</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">./</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">x</span><span sty
le="color:rgb(92,92,92);">.^</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span> <span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(176,24,19);">endfunction</span>
<span style="color:rgb(0,0,0);">x_array</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">0.1</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(188,143,143);">0.1</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(188,143,143);">50</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// define 500 points on the x-axis</span>
<span style="color:rgb(0,0,0);">z_1_array</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);text-decoration:underline;">H1</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">x_array</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// Calculate H1(x)</span>
<span style="color:rgb(174,92,176);text-decoration:underline;">scf</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">a</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(174,92,176);text-decoration:underline;">gca</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(174,92,176);text-decoration:underline;">plot</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">x_array</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">z_1_array</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(188,143,143);">-r</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(50,185,185);">xtitle</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">Struve function</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">x (2ka)</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">output (z)</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(174,92,176);text-decoration:underline;">legend</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">H1(x)</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span></pre>
<br>
</body>
</html>