Calculating Number of Modes

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

% number_of_modes.

m
% Calculate the number of modes in a given frequency range
%
%% User input
freq = 1:100:2500; % don't start at zero!
freq_band = 10; % each calculation is number of modes in range ...
%[freq-freq_band/2,freq+freq_band/2]
room_dimensions = [7 10 3]; % [x y z] in m
soundspeed = 343; % m/s
%% Calculations
foverc = freq/soundspeed;
Lx = room_dimensions(1);
Ly = room_dimensions(2);
Lz = room_dimensions(3);
volume = Lx*Ly*Lz;
surface_area = 2*Lx*Ly + 2*Lx*Lz + 2*Ly*Lz;
num_modes = (4*pi*volume*foverc.^3 + pi*surface_area/2*foverc.^2 + (Lx+Ly+Lz)/2*
foverc).*...
(freq_band./freq);
num_modes = round(num_modes); % no such thing as 0.5 modes
figure;
plot(freq,num_modes,'b.');
xlabel('Frequency (Hz)');
ylabel('Number of modes');

You might also like