sfstoolbox / sfs-matlab

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

Error for some combinations of dimensions for sound field of monochromatic plane wave #93

Closed fietew closed 8 years ago

fietew commented 8 years ago

For a plane_wave some combinations of dimensions yield an error. Try:

f = 2000;
xs = [0, -1, 0];
P = sound_field_mono_plane_wave(0,0,0,xs,f,conf);  % works
P = sound_field_mono_plane_wave([-1,1],0,0,xs,f,conf);  % works
P = sound_field_mono_plane_wave(0,[-1,1],0,xs,f,conf);  % does not work
P = sound_field_mono_plane_wave(0,0,[-1,1],xs,f,conf);  % does not work

P = sound_field_mono_plane_wave([-1,1],[-1,1],0,xs,f,conf);  % works
P = sound_field_mono_plane_wave([-1,1],0,[-1,1],xs,f,conf);  % works
P = sound_field_mono_plane_wave(0,[-1,1],[-1,1],xs,f,conf);  % does not work

P = sound_field_mono_plane_wave([-1,1],[-1,1],[-1,1],xs,f,conf); % does not work

This has something to do with the computations for pw in greens_function_mono, but I was not able to understand, what is happening there. I think, we did not test the pw option when we added non-regular grids to the toolbox (see #33).

P.S.: Maybe also a simplification of the computation can be done.

hagenw commented 8 years ago

@fietew: could you also fix this for the time domain, please.