D = 0.067;Ugs = [0.047,0.061,0.288,0.344,0.404,0.544,0.709,0.945,1.418,1.891,2.363,2.836,4.727];Uls = ones(1,13)*0.047;Uls1 = ones(1,13)*0.071;Uls2 = ones(1,13)*0.095;Uls3 = ones(1,13)*0.142;g = 9.81;rho_gas=1.18;rho_liq=900;Ugs_aht= Ugs *((rho_gas).^0.5)/(g * D *(rho_liq - rho_gas)).^0.5;Uls_aht= Uls *((rho_liq).^0.5)/(g * D *(rho_liq - rho_gas)).^0.5;Uls1_aht= Uls1 *((rho_liq).^0.5)/(g * D *(rho_liq - rho_gas)).^0.5;Uls2_aht= Uls2 *((rho_liq).^0.5)/(g * D *(rho_liq - rho_gas)).^0.5;Uls3_aht= Uls3 *((rho_liq).^0.5)/(g * D *(rho_liq - rho_gas)).^0.5;print(Uls_aht, Uls1_aht,Uls2_aht,Uls3_aht)C = ((Ugs_aht).^0.5) + ((Uls_aht).^0.5);C1 = ((Ugs_aht).^0.5) + ((Uls1_aht).^0.5);C2 = ((Ugs_aht).^0.5) + ((Uls2_aht).^0.5);C3 = ((Ugs_aht).^0.5) + ((Uls3_aht).^0.5); flow = ones(1,13); flow = string('flow'); for i = 1:13 if C <= 0.2(i) flow(i)= 'Bubble' if C1 <= 0.89(i) flow(i)= 'Slug' if C2 <= 0.98(i) flow(i)= 'Transition' if C3 >= 1.00(i) flow(i)= 'Churn' end end end end% end
Ugs = Ugs.';Usl = Usl.';Usl1 = Usl1.';Usl2 = Usl2.';Usl3 = Usl3.';C = C.';C1 = C1.';C2 = C2.';C3 = C3.';Uls_aht = Uls_aht.';Uls1_aht = Uls1_aht.';Uls2_aht = Uls2_aht.';Uls3_aht = Uls3_aht.';% flow = flow.';
T = table(Ugs,Uls_aht,Uls1_aht,Uls2_aht,Uls3_aht,C,C1,C2,C3)
MATLAB: Dynamic array storage with for loop
dynamic arrayfor loopMATLAB
Best Answer