Aufgrund einer Wartung wird GitLab am 19.10. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 19.10. between 8:00 and 9:00 am.

dfBulbMS.m 1.34 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function [ freqs, mags, metadata ] = dfBulbMS( alpha, beta, basepath )
% Example magnitude spectrum of bulb shape for higher frequencies

% <ITA-Toolbox>
% This file is part of the application openDAFF for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
% </ITA-Toolbox>

    
    % This is just an example directivity.
    % For low frequencies it is omnidirectional
    % For higher frequencies it focusses in the frontal direction

    % Third-octave resolution
    freqs = [20 25 31.5 40 50 63 80 100 125 160 ...
             200 250 315 400 500 630 800 1000 1250 1600 ...
             2000 2500 3150 4000 5000 6300 8000 10000 12500 16000 20000];
    
    channels = 1;
    mags = zeros(channels, length(freqs));
21
    metadata.desc = 'magnitude spectrum of bulb shape for higher frequencies';
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    
    for c=1:channels
        for f=1:length(freqs)
            % Great circle angle - Spherical law of cosines
            phi = acos( cos(alpha*pi/180) * cos( (beta-90) *pi/180) ) * 180/pi;

            % Exponential weighting lamba
            % 20 Hz -> 0, 20 kHz -> 0.002
            lambda = 0.002 * freqs(f) / 10000;
            
            % Frequency weighting
            w = log(freqs(f)) / log(20000) / 2;
            
            mags(c,f) = (1-w) + w*exp(-lambda*phi^2);
        end
    end   
end