how to use technique to save value in final matrix - matlab coding?
1 view (last 30 days)
Show older comments
I have duct simulation parameter as following
Nmod = 5; % modes in duct 1 to 5
L = 1.2; % length of duct
K = 0.051; % impedance at one end
zi = 0.315;
zm = 0.775;
c = 340 ;
roh = 1.225;
S = 1;
eta =1 ;
betan = -(1:Nmod)*pi/L;
alfa = 1/(2*L)*log((1-K)/(1+K));
%****and formulas for matrices*******
Anr = c * [alfa betan; -betan alfa]; % formula for Anr matrices
Ani = c*eta*[1 0;0 1];
An = [Anr -Ani ; Ani Anr]; % Anr and Ani matrices pack in An
i want to do this simulation for Nmod = 5 times and save the An value for each mode 1,2,3,4,5 in final Ai matrix ?
how should i do this in matlab?
0 Comments
Answers (1)
Pourya Alinezhad
on 10 Jun 2013
with a for loop you can write following code: for kk=1:Nmod {all your code goes here} Ai(kk)=An; end
so Ai(1) will hold An for Nmod=1 ,Ai(2) will hold An for Nmod=2 and so on....
0 Comments
See Also
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!