- what conditions define each set of values?
- do you have 380 objects in which you are applying one of two sets of values?
Set different properties using for loop
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I'm modelling an adsorber bed and I need to set two different materials.
I have basic notions of programming and I would do it like this:
L=3.8
nz=380
z=linspace(0,L,Nz);
%Activated alumina first
for z=1:41
epsb=0.26; %bed porosity
dp=5E-3; %activated alumina diameter
tau=3.6; %tortuosity
rpore=4.5E-9; %pore radius
ep=0.28; %particle porosity
rhop=820; %particule density
else
epsb=0.4; %bed porosity
dp=2.7E-3; %Zeolite 13x-APG diameter
tau=4; %tortuosity
rpore=6.25E-10; %pore radius
ep=0.3; %particle porosity
rhop=1099.5; %particule density
end
I'd appreciate your help
3 Kommentare
Adam Danz
am 28 Sep. 2022
I don't have enough background info on what you're doing or how the variables in your quesitons are applied to your model.
Perhaps each variable could be a 1x2 vector where var(1) value of propery var is applied to one material and var(2) applied to the other material.
Antworten (1)
David Hill
am 28 Sep. 2022
Recommend a lookup table for the material. Then just index into when data is needed.
matLookup=[0.26,5E-3,3.6,4.5E-9,0.28,820;...
0.4,2.7E-3,4,6.25E-10,0.3,1099.5];
L=3.8
nz=380
z=linspace(0,L,Nz);
for z=1:numel(z)
idx=ismember(z,[1 5 7 9 11 17])+1;%conditional for zeolite
%do some calculations
N(z)=matLookup(idx,1)*matLookup(idx,5)/matLookup(idx,3);
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Quaternion Math 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!