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 ) )
clearticc = 344 ; % speed of sound (m/s)
fL=zeros(1,9); % initialize vector
fw=zeros(1,9); % initialize vectorfh=zeros(1,9); % initialize vectorw= 2.20 ;L= 3.50 ;h= 3.02 ;% AXIAL MODES
for n = 1: 9fL(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:4for nw = 1:4fLw(nL,nw) = ( c/2 ) * ( sqrt( ((nL/L))^2 + ((nw/w))^2 )) ;for nh = 1:4fwh(nw,nh) = ( c/2 ) * ( sqrt( ((nw/w))^2 + ((nh/h))^2 )) ;fLh(nL,nh) = ( c/2 ) * ( sqrt( ((nL/L))^2 + ((nh/h))^2 )) ;endendend% Oblique Modes
fLwh = zeros(1,2);for nL= 1:2for nw = 1:2for nh = 1:2fLwh(nL,nw,nh) = ( c/2 ) * ( sqrt( ((nL/L))^2 + ((nw/w))^2 + ((nh/h))^2 ) ) ;endendend' AXIAL MODES 'fLfwfh'TANGENTIAL MODES'fLwfLhfwh'OBLIQUE MODES'fLwhtoc
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
Best Answer