sfstoolbox / sfs-matlab

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

add delay offset mechanism to nfchoa time domain driving function #95

Closed fietew closed 7 years ago

fietew commented 8 years ago

In the original publication ( http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=6082325&tag=1 ) and the current implementation of the NFCHOA time domain driving functions the delay in Eq. (9) and (10) is omitted. This results in same issues we have already tackled for WFS in #62. At the moment I have just used the conf.wfs.t0 for the NFCHOA time domain functions in order to get a quick prototype of the functionality.

Try:

SFS_start;

close all;

conf = SFS_config;
conf.secondary_sources.size = 3;
conf.secondary_sources.number = 56;
conf.secondary_sources.geometry = 'circular';
conf.secondary_sources.center = [0,0,0];
conf.resolution = 500;
conf.plot.normalisation = 'max';
conf.plot.loudspeakers = false;
conf.plot.usedb = true;

X = [-2,2];
Y = [-1.5,2.5];
Z = 0;

R = conf.secondary_sources.size/2;
xc = conf.secondary_sources.center;

for src = {'ps', 'pw'}

  switch src{1}
    case 'ps'
      xs = [0, 2, 0];
      ts = [0, norm(xs - xc)/conf.c*conf.fs];
    case 'pw'
      xs = [0, -1, 0];
      ts = [0, R/conf.c*conf.fs];
  end

  for t = ts
    for option = {'ground truth','system','source'}
        switch option{1}
          case 'ground truth'
            conf.plot.loudspeakers = false;
            sound_field_imp(X,Y,Z,[xs, 1, 0, 0, 1], src{1}, 1, t, conf);
          case {'system', 'source'}
            conf.wfs.t0 = option{1};
            conf.plot.loudspeakers = false;
            sound_field_imp_nfchoa(X,Y,Z,xs,src{1},t,conf);
        end    
        title(sprintf('%s %s t=%2.2f', option{1}, src{1}, t));
    end
  end
end