how to use technique to save value in final matrix - matlab coding?
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Pourya Alinezhad
2013 年 6 月 10 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Special Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!