Filter löschen
Filter löschen

how to use technique to save value in final matrix - matlab coding?

1 Ansicht (letzte 30 Tage)
Aniket
Aniket am 5 Mai 2013
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?

Antworten (1)

Pourya Alinezhad
Pourya Alinezhad am 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....

Kategorien

Mehr zu Special Functions finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by