sfstoolbox / sfs-matlab

SFS Toolbox for Matlab/Octave
https://sfs-matlab.readthedocs.io
MIT License
97 stars 39 forks source link

Alternative referencing scheme for focused sources in WFS #146

Closed fietew closed 7 years ago

fietew commented 7 years ago

I discovered an issue regarding the existing referencing scheme for the focused source in WFS, namely reference_point and reference_line.

Reference Point:

        %         _____________________
        %        |      |xref-x0|
        % g0 = _ |---------------------
        %       \|||xref-x0| - |xs-x0||

Reference Line:

        %        ______________________
        % g0 = \| d_ref / (d_ref - d_s)

Both schemes have the drawback, that the denominator can become zero for non-pathological cases. Hence particular secondary sources have a unreasonably high amplitude. I added a scheme called reference_circle which ensure amplitude correct synthesis on a circle around the focused source, which does not have these issues. Please execute the following example to compare reference_point and reference_circle. The green dots in the plots for reference_point indicate the theoretical coordinates on the circular SSD, where the amplitude of the seconday source is infinity.

conf = SFS_config;

conf.dimension = '2.5D';

conf.plot.normalisation = 'center';

conf.secondary_sources.geometry = 'circular';
conf.secondary_sources.number = 256;
conf.secondary_sources.size = 3;

conf.t0 = 'source';
conf.usetapwin = false;

X = [-1.55, 1.55];
Y = [-1.55, 1.55];
Z = 0;

xs = [0 0.5 0 -sqrt(0.5) -sqrt(0.5) 0]; 
src = 'fs';
t = norm(xs(1:3) - conf.xref)/conf.c;
f = 1000;

conf.driving_functions = 'reference_point';
conf.plot.usedb = true;
sound_field_imp_wfs(X,Y,Z, xs, src, t, conf);
hold on;
xs(1:3) = xs(1:3) - conf.xref;
[phis, rs] = cart2pol(xs(1), xs(2));
r0 = conf.secondary_sources.size/2;
phi0 = [-1,1]*acos(rs/2/r0) + phis;
plot( conf.xref(1) + r0*cos(phi0), conf.xref(2) + r0*sin(phi0), 'o', 'MarkerFaceColor',[0.0,1.0,0.0] );
hold off;
conf.plot.usedb = false;
sound_field_mono_wfs(X,Y,Z, xs, src, f, conf);
hold on;
xs(1:3) = xs(1:3) - conf.xref;
[phis, rs] = cart2pol(xs(1), xs(2));
r0 = conf.secondary_sources.size/2;
phi0 = [-1,1]*acos(rs/2/r0) + phis;
plot( conf.xref(1) + r0*cos(phi0), conf.xref(2) + r0*sin(phi0), 'o', 'MarkerFaceColor',[0.0,1.0,0.0] );
hold off;

conf.driving_functions = 'reference_circle';
conf.plot.usedb = true;
sound_field_imp_wfs(X,Y,Z, xs, src, t, conf);
conf.plot.usedb = false;
sound_field_mono_wfs(X,Y,Z, xs, src, f, conf);
hagenw commented 7 years ago

That's true, interesting problem. Should we just add this as a workaround or is there the possibility to fix the problem in changing the underlying equations for a reference point or line?

/cc @fs446

fietew commented 7 years ago

The reference point scheme is based on a single stationary phase approximation, while the others include a whole reference trajectory (such as line or circle) and are based on two stationary phase approximations. See also #136. The point is, that the amplitude correct synthesis at a reference point is automatically achieved by any other scheme, if the reference point is part of the reference trajectory. It hence might not be necessary to have reference point scheme anymore (same for point source and plane wave). Note, that the reference line scheme seamlessly works, if the SSD is linear, which is mandatory.

I think we should merge this right now and continue to unify the referencing stuff in #143.