@@ -13,7 +13,8 @@ function draw_loudspeakers(x0,dimensions,conf)
13
13
% DRAW_LOUDSPEAKERS(x0,dimensions,conf) draws loudspeaker symbols or filled
14
14
% points at the given secondary source positions. This can be controlled by
15
15
% the conf.plot.realloudspeakers setting. The loudspeaker symbols are pointing
16
- % in their given direction.
16
+ % in their given direction and are colored accordingly to their weights,
17
+ % whereby the weights are scaled to an absolute maximum of 1 before.
17
18
%
18
19
% See also: plot_sound_field
19
20
@@ -78,42 +79,41 @@ function draw_loudspeakers(x0,dimensions,conf)
78
79
x0(: ,2 ) = x0(: ,3 );
79
80
end
80
81
81
- % Weightings of the single sources
82
- win = x0(: ,7 );
83
-
84
- % Plot only "x" at the loudspeaker positions, use this as default for all cases
82
+ % Plot only "o" at the loudspeaker positions, use this as default for all cases
85
83
% that are not the x-y-plane
86
84
if ~p .realloudspeakers || ~(dimensions(1 )&&dimensions(2 ))
85
+
87
86
if p .realloudspeakers && ~(dimensions(1 )&&dimensions(2 ))
88
87
warning(' %s : Real loudspeaker can only be drawn in the x-y-plane' , ...
89
88
upper(mfilename ));
90
89
end
91
- % plot all secondary sources with the same color + symbol
90
+ % Plot all secondary sources with the same color + symbol
92
91
plot(x0(: ,1 ),x0(: ,2 ),' o' , ...
93
92
' MarkerFaceColor' ,' k' , ...
94
93
' MarkerEdgeColor' ,' k' , ...
95
94
' MarkerSize' ,4 );
95
+
96
96
else
97
+
98
+ % Weightings of the single loudspeakers (scale maximum to 1)
99
+ weights = x0(: ,7 ) / max(abs(x0(: ,7 )));
97
100
% Set fill color for active loudspeakers
98
- % Scale the color. sc = 1 => black. sc = 0.5 => gray.
101
+ % Scale the color: sc = 1 => black, sc = 0.5 => gray.
99
102
sc = 0.6 ;
100
- fc = [(1 - sc .* win ), ...
101
- (1 - sc .* win ), ...
102
- (1 - sc .* win )];
103
+ fc = [(1 - sc .* weights ), ...
104
+ (1 - sc .* weights ), ...
105
+ (1 - sc .* weights )];
103
106
107
+ % Plot a real speaker symbol at the desired position
108
+ % vertex coordinates with height and width after lssize
104
109
w = p .lssize ;
105
110
h = p .lssize ;
106
-
107
- % Plot a real speaker symbol at the desired position
108
- % vertex coordinates
109
- % v1 = [-h/2 -h/2 0 0 -h/2 ; -w/2 w/2 w/2 -w/2 -w/2];
110
- % v2 = [0 h/2 h/2 0 ; -w/6 -w/2 w/2 w/6];
111
111
v1 = [-h - h - h / 2 - h / 2 - h ; - w / 2 w / 2 w / 2 - w / 2 - w / 2 ; 0 0 0 0 0 ];
112
112
v2 = [-h / 2 0 0 - h / 2 ; - w / 6 - w / 2 w / 2 w / 6 ; 0 0 0 0 ];
113
113
114
114
hold on ;
115
115
116
- % draw loudspeakers
116
+ % Draw loudspeakers
117
117
for n= 1 : nls
118
118
119
119
% Get the azimuth direction of the secondary sources
@@ -122,23 +122,20 @@ function draw_loudspeakers(x0,dimensions,conf)
122
122
% Rotation matrix (orientation of the speakers)
123
123
% R = [cos(phi(n)) -sin(phi(n));sin(phi(n)) cos(phi(n))];
124
124
R = rotation_matrix(phi );
125
-
126
125
for k= 1 : length(v1 )
127
126
vr1(: ,k ) = R * v1(: ,k );
128
127
end
129
-
130
128
for k= 1 : length(v2 )
131
129
vr2(: ,k ) = R * v2(: ,k );
132
130
end
133
131
134
- % shift
132
+ % Shift
135
133
v01(1 ,: ) = vr1(1 ,: ) + x0(n ,1 );
136
134
v01(2 ,: ) = vr1(2 ,: ) + x0(n ,2 );
137
135
v02(1 ,: ) = vr2(1 ,: ) + x0(n ,1 );
138
136
v02(2 ,: ) = vr2(2 ,: ) + x0(n ,2 );
139
137
140
-
141
- % Draw speakers
138
+ % Draw loudspeakers
142
139
fill(v01(1 ,: ),v01(2 ,: ),fc(n ,: ));
143
140
fill(v02(1 ,: ),v02(2 ,: ),fc(n ,: ));
144
141
0 commit comments