Skip to content

Commit

Permalink
Add additional functon for calculating zeros of Hankel function
Browse files Browse the repository at this point in the history
See #57 (comment)
The result seems to be more or less identical to the one obtained with
sphbesselh_zeros() in terms of stability -- the obtained values for z, p differ
quite a lot.
One advantage of sphhankel_laplace() is that it will not lead to Inf or Nan, but
only to large numerical errors in the reproduced sound field for orders >85.

Maybe it would be a good idea to try to calculate z directly via an formula
without using the zeros() function.
  • Loading branch information
hagenw committed Feb 26, 2016
1 parent 0ee7e51 commit 5907123
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
35 changes: 35 additions & 0 deletions SFS_general/sphhankel_laplace.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function [z,p] = sphhankel_laplace(order)

hankel = struct(...
'zeros',[],...
'poles',[],...
'scale',[],...
'delay',[],...
'nominator',[],...
'denominator',[]);

hankel = repmat(hankel,order+1,1);
for n=0:order
% nominator
hankel(n+1).nominator = zeros(1, n+1);
for k=0:n-1
hankel(n+1).nominator(k+1) = ...
((2*n-k-1)*(2*n - k))/(2*(n-k))*hankel(n).nominator(k+1);
end
hankel(n+1).nominator(n+1) = 1;
end

for n=0:order
% flip nominator polynoms
hankel(n+1).nominator = hankel(n+1).nominator(end:-1:1);
% zeros
hankel(n+1).zeros = roots(hankel(n+1).nominator);
% denominator
hankel(n+1).denominator = zeros(1, n+2);
hankel(n+1).denominator(1) = 1;
% poles
hankel(n+1).poles = roots(hankel(n+1).denominator);
end

z = hankel(order).zeros;
p = hankel(order).poles;
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@

%% ===== Computation =====================================================
% Find spherical hankel function zeros
[z,p] = sphbesselh_zeros(N);
%[z,p] = sphbesselh_zeros(N);
[z,p] = sphhankel_laplace(N);

% Get the delay and weighting factors
if strcmp('2D',dimension)
Expand Down

0 comments on commit 5907123

Please sign in to comment.