sfstoolbox / sfs-matlab

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

Correct sign in NFC-HOA time domain driving function #58

Closed hagenw closed 8 years ago

hagenw commented 8 years ago

I changed the NFC-HOA time domain driving function, according to #55. But there are still some problems.

Try the following commands:

conf = SFS_config;
conf.nfchoa.order = 32;
sound_field_imp_nfchoa([-2 2],[-2 2],0,[1 0 0],'pw',300,conf)
sound_field_imp_nfchoa([-2 2],[-2 2],0,[2.5 0 0],'ps',300,conf)

Here are the results from before the change:

nfchoa_pw_before nfchoa_ps_after

And here after the changes:

nfchoa_pw_after

nfchoa_ps_before

As you can see, the results for the point source is still correct, but in the case of the plane wave we have no a wrong direction.

narahahn commented 8 years ago

I just found another error in the plane wave driving function. The (-1)^abs(m) term of Eq. (10) is missing (Spors et al, 2011). But you have to be careful, when fixing this. If you just multiply sos with (-1)^abs(m) the numerator and denominator of the second-order section are multiplied simultaneously, and cancelled out. One possibility to do it correctly would be:

sos(1,1:3) = sos(1,1:3) * (-1)^abs(order);
hagenw commented 8 years ago

OK, I implemented it and it seems to work now. Could you also test it, please.

narahahn commented 8 years ago

Great. Also works in my Matlab.