Ascending order-room modes
Mostrar comentarios más antiguos
Hi all,
I created a script in order to calculate room modes using this formula : f = ( c/2 ) * ( sqrt( ((n/L))^2 + ((n/w))^2 + ((n/h))^2 ) )
L, w, h are the length,width and height and n:0,1,2,3,4 , c=speed of sound
So, I calculated in such a way that the different mode combinations are illustrated separately. Now, I want to put ALL the results that I found into one vector/matrix in ascending order. I tried to do something with the "sort" command but it couldn't work with all these matrices. Can someone help on this?
That's the code:
% Room Mode Calculator RC1
% f = ( c/2 ) * ( sqrt( ((nL/L))^2 + ((nw/w))^2 + ((nh/h))^2 ) )
clear
tic
c = 344 ; % speed of sound (m/s)
fL=zeros(1,9); % initialize vector
fw=zeros(1,9); % initialize vector
fh=zeros(1,9); % initialize vector
w= 2.20 ;
L= 3.50 ;
h= 3.02 ;
% AXIAL MODES
for n = 1: 9
fL(n) = (c/2) * (n/L) ;
fw(n) = (c/2) * (n/w) ;
fh(n) = (c/2) * (n/h) ;
end
% Tangential modes
fLw = zeros(1,4);
fwh = zeros(1,4);
fLh = zeros(1,4);
for nL= 1:4
for nw = 1:4
fLw(nL,nw) = ( c/2 ) * ( sqrt( ((nL/L))^2 + ((nw/w))^2 )) ;
for nh = 1:4
fwh(nw,nh) = ( c/2 ) * ( sqrt( ((nw/w))^2 + ((nh/h))^2 )) ;
fLh(nL,nh) = ( c/2 ) * ( sqrt( ((nL/L))^2 + ((nh/h))^2 )) ;
end
end
end
% Oblique Modes
fLwh = zeros(1,2);
for nL= 1:2
for nw = 1:2
for nh = 1:2
fLwh(nL,nw,nh) = ( c/2 ) * ( sqrt( ((nL/L))^2 + ((nw/w))^2 + ((nh/h))^2 ) ) ;
end
end
end
' AXIAL MODES '
fL
fw
fh
'TANGENTIAL MODES'
fLw
fLh
fwh
'OBLIQUE MODES'
fLwh
toc
So, how can I put all the results into one vector or matrix and place them in ascending order? I always have problems with matlab and most of the times with easy things. I can not understand well its way of "thinking"..
Thanks in advance,
Aris
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!