Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here is my code: function Visous_Inertial_Thermal_Dissipation_Model( L,d,Q ) % T

ID: 3620724 • Letter: H

Question

Here is my code:

function Visous_Inertial_Thermal_Dissipation_Model( L,d,Q )
% This program computes the absorption coefficients over a desired range of frequencies of a uniform porous celullar
% solid based on Biot/Zwikker-Kosten single porosity model. Where L is the
% thickness of the sample, a is the pore size, d is the size of the air gap
% behind the sample and Q is the porosity.
alpha=[];
a=0.0001;
while a<=5
for f=1:100:2000
u=1.9e-05;
x=(8*u)/a^2;
G=1.4;
Pr=.702;
Po=101320;
qo=1.2;
Ua=((4*pi*qo*f)/(x))^(1/2);
za=(1+i)*Ua;
Ja=besselj(1,za);
Fa=(2*Ja)/((1+i)*Ua*Ja);
pw=(qo/Q)/(1-Fa);
Ub=(Pr*Ua);
zb=(1+i)*Ub;
Jb=besselj(0,zb);
Fb=(2*Jb)/((1+i)*Ub*Jb);
kw=(G*Po/Q)/(1+(G-1)*Fb);
Zw=(pw*kw)^(1/2);
mw=i*2*pi*f*(pw/kw)^(1/2);
co=343;
Zr=-(qo*co)*i*cot((2*pi*f*d)/(co));
Zs=Zw*((Zr*cosh(mw*L)+Zw*sinh(mw*L))/(Zr*sinh(mw*L)+Zw*cosh(mw*L)));
Zo=qo*co;
alpha=[alpha,1-abs((Zs-Zo)/(Zs+Zo))^(2)];
end
a=a+0.25;
end
alpha
end

Currently this code makes (alpha = [1x400] matrix). This is done by going through the for loop (for f=1:100:2000) while (a<5). After the first time through, (a) is increased by (0.25) and this looping continues until (a<5). However, I would like to create a new row every time the program cycles back through the for loop in order to create an alpha matrix of (alpha = [20x20]) instead of the current (alpha = [1x400] matrix).

If anyone knows how to do this please let me know. Thank you in advance.

Explanation / Answer

end SO what I added was a new matrix, alpha_new, and I just walked through alpha and broke off chunks of 20 units, and made that a new row. If you wanted to do this with a larger array, you could make the index for i based off of the size of the input. I hope this helps!
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote