Borrar filtros
Borrar filtros

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

2 visualizaciones (últimos 30 días)
Aniket
Aniket el 5 de Mayo de 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?

Respuestas (1)

Pourya Alinezhad
Pourya Alinezhad el 10 de Jun. de 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....

Categorías

Más información sobre Special Functions en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by