Skip to content

Commit 178317d

Browse files
committed
Added deprecated code from the old sfs svn repository
1 parent 82fdb35 commit 178317d

File tree

76 files changed

+4362
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+4362
-0
lines changed

SFS_HOA_IIR/Bessel.m

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
function [w,config] = Bessel(config)
2+
%==========================================================================
3+
% show hankelfunction
4+
x = 0:0.001:20;
5+
6+
o = sphbesselh(0, 2, x);
7+
p = sphbesselh(1, 2, x);
8+
q = sphbesselh(2, 2, x);
9+
z = hankel_rekursiv_show(config);
10+
11+
figure;
12+
subplot(2,2,1)
13+
plot(x,real(o));
14+
hold on
15+
plot(x,real(p),'r');
16+
hold on
17+
plot(x,real(q),'g');
18+
%title('real part')
19+
grid on;
20+
axis([0 20 -0.5 1])
21+
22+
23+
subplot(2,2,2)
24+
plot(x,imag(o));
25+
hold on
26+
plot(x,imag(p),'r');
27+
hold on
28+
plot(x,imag(q),'g');
29+
grid on;
30+
axis([0 20 -1 3])
31+
%title('imaginary part')
32+
33+
subplot(2,2,3)
34+
plot(x,20*log10(abs(o)))
35+
hold on
36+
plot(x,20*log10(abs(p)),'r')
37+
hold on
38+
plot(x,20*log10(abs(q)),'g')
39+
%title('absolute value')
40+
grid on;
41+
axis([0 20 -30 30])
42+
43+
44+
subplot(2,2,4)
45+
plot(x,20*log10(abs(1./o)))
46+
hold on
47+
plot(x,20*log10(abs(1./p)),'r')
48+
hold on
49+
plot(x,20*log10(abs(1./q)),'g')
50+
%title('absolute value')
51+
grid on;
52+
axis([0 20 -30 30])
53+
54+
% figure;
55+
% subplot(2,2,1)
56+
% plot(x,real(q))
57+
% hold on
58+
% plot(real(z(config.p+1,:)),'r:','LineWidth',2)
59+
% %==========================================================================
60+
% % non recursive calculation
61+
% y = sphbesselh(config.p, 2, config.k2.*config.R );
62+
63+
% % recursive calculation of Hankelfunction
64+
% z = hankel_rekursiv(config);
65+
% z = hankel_rekursiv_real_imag(config);
66+
%
67+
% figure;
68+
% subplot(2,2,1)
69+
% plot(config.f2,20*log10(abs(y)))
70+
% hold on
71+
% plot(config.f2,20*log10(abs(z(config.p+1,:))),'r:','LineWidth',2);
72+
% title('absolute value of hankelfunction 2nd kind non rec (blue) and rek (red)')
73+
% axis([0 20000 -30 30])
74+
%
75+
% subplot(2,2,2)
76+
% plot(config.f2,real(y));
77+
% hold on
78+
% plot(config.f2,real(z(config.p+1,:)),'r:','LineWidth',2);
79+
% title('real part of hankelfunction 2nd kind non rec (blue) and rek (red)')
80+
%
81+
% subplot(2,2,3)
82+
% plot(config.f2,imag(y));
83+
% hold on
84+
% plot(config.f2,imag(z(config.p+1,:)),'r:','LineWidth',2);
85+
% title('imaginary part of hankelfunction 2nd kind non rec (blue) and rek (red)')
86+
%
87+
88+
w = 1;
89+
end
90+
91+
92+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
2+
function[ps_b, ps_m] = HOA_driving_signal_broadband_mono_ps(config)
3+
4+
%=========================================================================
5+
%Calculation driving signal broadband point source
6+
L=length(config.x0);
7+
E=zeros(length(config.k2), L); %Matrix for coefficients and LS
8+
9+
% get spatial band limitation
10+
if mod(L,2)
11+
N21 = floor(L/2);
12+
N22 = N21;
13+
else
14+
N21 = L/2-1;
15+
N22 = L/2;
16+
end
17+
18+
% Position of sound source (relative to center of LS-array)
19+
xs_rel = ( config.xps(1) - config.xref(1) );
20+
ys_rel = ( config.xps(2) - config.xref(2) );
21+
22+
23+
rs_rel = sqrt( xs_rel.^2 + ys_rel.^2 ); % get distance from point source
24+
alphas_rel = atan2( ys_rel, xs_rel ); % get angle from position of point source
25+
26+
27+
for l=0:L-1 % loop over all loudspeakers
28+
29+
alpha_0 = 2*pi/L * l; % get angle for every LS in relation to given point
30+
31+
disp([l L-1]); % show time of computation for coeffcients
32+
33+
for m = -N21 : N22
34+
35+
E(:, l+1) = E(:, l+1) + 1/(2*pi*config.R) .* sphbesselh(abs(m),2, config.k2.*rs_rel) ./ ...
36+
sphbesselh(abs(m),2, config.k2.*config.R) .* exp( 1i * m * (alpha_0 - alphas_rel) );
37+
38+
end
39+
40+
end
41+
%=========================================================================
42+
% gd = zeros(length(config.k2),L);
43+
%
44+
% for n = 0:1:L-1
45+
%
46+
% disp([n L-1])
47+
%
48+
% grp_delay = grpdelay(E(:,n+1),1,config.k2,config.fs);
49+
% gd(:,n+1) = gd(:,n+1) + grp_delay;
50+
%
51+
% end
52+
53+
%=========================================================================
54+
% calculation of driving signal for ps
55+
% L=length(config.x0);
56+
% D=zeros(1, L); %Matrix for coefficients and LS
57+
%
58+
%
59+
% for l=0:L-1 % loop over all loudspeakers
60+
%
61+
% alpha_0 = 2*pi/L * l; % get angle for every LS in relation to given point
62+
%
63+
% disp([l L-1]); % show time of computation for coeffcients
64+
%
65+
% for m = -N21 : N22
66+
%
67+
% D(l+1) = D(l+1) + 1/(2*pi*config.R) .* sphbesselh(abs(m),2, config.k.*rs_rel) ./ ...
68+
% sphbesselh(abs(m),2, config.k.*config.R) .* exp( 1i * m * (alpha_0 - alphas_rel) );
69+
%
70+
% end
71+
%
72+
73+
%==========================================================================
74+
75+
%==========================================================================
76+
ps_b = E; % Driving function broadband
77+
ps_m = 1;
78+
%ps_m = D; % Driving function monofrequent
79+
end
80+
%==========================================================================
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
function[ps_b_r,ps_m_r] = HOA_driving_signal_broadband_mono_ps_rek(config)
2+
%=========================================================================
3+
z = hankel_rekursiv(config); %rekursiv calculation of Hankelfunctions with r = R
4+
h2 = hankel_rekursiv_ps(config); %rekursiv calculation of Hankelfunctions with r = rs_rel
5+
%=========================================================================
6+
%Calculation driving signal broadband point source
7+
L=length(config.x0);
8+
E=zeros(length(config.k2), L); %Matrix for coefficients and LS
9+
10+
% get spatial band limitation
11+
if mod(L,2)
12+
N21 = floor(L/2);
13+
N22 = N21;
14+
else
15+
N21 = L/2-1;
16+
N22 = L/2;
17+
end
18+
19+
% Position of sound source (relative to center of LS-array)
20+
xs_rel = ( config.xps(1) - config.xref(1) );
21+
ys_rel = ( config.xps(2) - config.xref(2) );
22+
23+
24+
rs_rel = sqrt( xs_rel.^2 + ys_rel.^2 ); % get distance from point source
25+
alphas_rel = atan2( ys_rel, xs_rel ); % get angle from position of point source
26+
27+
h2 = h2.';
28+
z = z.';
29+
30+
for l=0:L-1 % loop over all loudspeakers
31+
32+
alpha_0 = 2*pi/L * l; % get angle for every LS in relation to given point
33+
34+
disp([l L-1]); % show time of computation for coeffcients
35+
36+
for m = -N21 : N22
37+
38+
E(:, l+1) = E(:, l+1) + 1/(2*pi*config.R) .* h2(:,abs(m)+1) ./ ...
39+
z(:,abs(m)+1) .* exp( 1i * m * (alpha_0 - alphas_rel) );
40+
41+
end
42+
43+
end
44+
%%=========================================================================
45+
46+
% % calculation of driving signal for ps monofreqent
47+
L=length(config.x0);
48+
D=zeros(1, L); %Matrix for coefficients and LS
49+
50+
51+
for l=0:L-1 % loop over all loudspeakers
52+
53+
alpha_0 = 2*pi/L * l; % get angle for every LS in relation to given point
54+
55+
disp([l L-1]); % show time of computation for coeffcients
56+
57+
for m = -N21 : N22
58+
59+
D(l+1) = D(l+1) + 1/(2*pi*config.R) .* sphbesselh(abs(m),2, config.k.*rs_rel) ./ ...
60+
sphbesselh(abs(m),2, config.k.*config.R) .* exp( 1i * m * (alpha_0 - alphas_rel) );
61+
62+
end
63+
%
64+
65+
%==========================================================================
66+
67+
%==========================================================================
68+
ps_b_r = E; % Driving function broadband
69+
% ps_m_r = 1;
70+
ps_m_r = D; % Driving function monofrequent
71+
%==========================================================================
72+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
function[pw_b, pw_m] = HOA_driving_signal_broadband_mono_pw(config)
2+
%==========================================================================
3+
4+
% calculation of driving signal broadband plane wave
5+
6+
L=length( config.x0 );
7+
F=zeros( length( config.k2 ), L ); %Matrix for coefficients and LS
8+
9+
al=atan2( config.x0( 2,: ), config.x0( 1,: ) );
10+
11+
% get spatial band limitation
12+
if mod( L,2 )
13+
N21 = floor( L/2 );
14+
N22 = N21;
15+
else
16+
N21 = L/2-1;
17+
N22 = L/2;
18+
end
19+
20+
21+
for l=0:L-1 % loop over all loudspeakers
22+
23+
disp([l L-1]); %display computation time of loop
24+
25+
for m = -N21 : N22
26+
27+
F(:, l+1) = F(:, l+1) + (2./config.R)* -1i^(abs( m ) )./ (-1i*config.k2) * 1./ ...
28+
sphbesselh(abs( m ), 2, config.k2.*config.R) .* exp(1i*m* (config.al_pw-al( l+1 ) ) );
29+
30+
end
31+
32+
end
33+
%=========================================================================
34+
% gd = zeros(length(config.k2),L);
35+
%
36+
% for n = 0:1:L-1
37+
%
38+
% disp([n L-1])
39+
%
40+
% grp_delay = grpdelay(F(:,n+1),1,config.k2,config.fs);
41+
% gd(:,n+1) = gd(:,n+1) + grp_delay;
42+
%
43+
% end
44+
45+
%==========================================================================
46+
%calculation of driving signal for pw
47+
48+
L=length( config.x0 );
49+
E=zeros( 1,L );
50+
51+
52+
for l=0:L-1 % loop over all loudspeakers
53+
54+
disp([l L-1]); %diplay computation time of loop
55+
56+
for m = -N21 : N22
57+
E(l+1) = E(l+1) + (2./config.R)* -1i^(abs( m ))./ (-1i*config.k) * 1./ ...
58+
sphbesselh(abs( m ), 2, config.k.*config.R) .* exp(1i*m*( config.al_pw-al( l+1 ) ) );
59+
end
60+
end
61+
%=========================================================================
62+
pw_b = F; % Driving function broadband
63+
%pw_m = 1;
64+
pw_m = E; % Driving function monofrequent
65+
end
66+
%=========================================================================
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
function[pw_b_r, pw_m_r] = HOA_driving_signal_broadband_mono_pw_rek(config)
2+
%%=========================================================================
3+
%%rekursiv calculation of Hankelfunctions
4+
%%=========================================================================
5+
z = hankel_rekursiv(config);
6+
% %========================================================================
7+
% % calculation of driving signal pw (broadband)
8+
% %========================================================================
9+
L=length( config.x0 );
10+
F=zeros( length( config.k2 ), L ); %Matrix for coefficients and LS
11+
12+
% get spatial band limitation
13+
al=atan2( config.x0( 2,: ), config.x0( 1,: ) );
14+
15+
if mod( L,2 )
16+
N21 = floor( L/2 );
17+
N22 = N21;
18+
else
19+
N21 = L/2-1;
20+
N22 = L/2;
21+
end
22+
23+
z = z.';
24+
25+
26+
27+
for l=0:L-1 % loop over all loudspeakers
28+
29+
disp([l L-1]); %display computation time of loop
30+
31+
for m = -N21 : N22
32+
33+
F(:, l+1) = F(:, l+1) + (2./config.R)* -1i^(abs( m ) )./ (-1i*config.k2) * 1./ ...
34+
z(:,abs(m)+1) .* exp(1i*m* (config.al_pw-al( l+1 ) ) );
35+
36+
37+
38+
end
39+
40+
end
41+
% %========================================================================
42+
% % calculation of driving signal for pw (monofrequent)
43+
% %========================================================================
44+
45+
46+
47+
% L=length( config.x0 );
48+
% E=zeros( 1,L );
49+
%
50+
% for l=0:L-1 % loop over all loudspeakers
51+
%
52+
% disp([l L-1]); %diplay computation time of loop
53+
%
54+
% for m = -N21 : N22
55+
%
56+
% E(l+1) = E(l+1) + (2./config.R)* -1i^(abs( m ))./ (-1i*config.k) * 1./ ...
57+
% sphbesselh(abs( m ), 2, config.k.*config.R) .* exp(1i*m*( config.al_pw-al( l+1 ) ) );
58+
%
59+
% end
60+
%
61+
% end
62+
63+
%%=========================================================================
64+
pw_b_r = F; % Driving function broadband
65+
pw_m_r = 1; % choose, if you don't need monofrequent calculation
66+
% pw_m_r = E; % Driving function monofrequent
67+
%%=========================================================================
68+
end

0 commit comments

Comments
 (0)