hello
I can make following suggestions :
- you can use readmatrix instead of load to read excel files
- also gradient exist now , so no need to use the older diff (also the resulting array will have the same size as the input array which is not the case with diff)
- reynold's number: the denominator should be mu (and not nu)
- solving the non linear equation can be done by hand , no need for fsolve here (and that is fine for me as I don't have the Optimisation toolbox
% solving (4.8 - n)/(n - 2.4) - 0.43*Ar^(0.57)*(1 - 2.4*(dp/D)^2.4) = 1
% is equivalent to :
% (4.8 - n)/(n - 2.4) = A , with A = 1 + 0.43*Ar^(0.57)*(1 - 2.4*(dp/D)^2.4) ; (A = 1.0303e+05)
% we have then n_R = (4.8 - 2.4*A)/(1+A);
- Up1,Up2,Up3 should be computed before the lines :
Ut_R1 = Up1 ./ (e1.^n_R);
Ut_R2 = Up2 ./ (e2.^n_R);
Ut_R2 = Up3 ./ (e3.^n_R);
otherwise the code fails
- minor bugs corrected like ho1/ho2/ho3 in the init section becomes ho_1/ho_2/ho_3 in the main code , corrected
I could plot the Up1,Up2,Up3 results vs time, but I don't know where Ut1/Ut2/Ut3 are computed - they show up in those lines
Ut_avg1 = mean([Ut1, Utz1]);
Ut_avg2 = mean([Ut2, Utz2]);
Ut_avg3 = mean([Ut3, Utz3]);
data = readmatrix('data.xlsx');
C1 = (Co1 * ho1) ./ height1;
C2 = (Co2 * ho2) ./ height2;
C3 = (Co3 * ho3) ./ height3;
grad1 = gradient(height1,dt);
grad2 = gradient(height2,dt);
grad3 = gradient(height3,dt);
Re1 = abs(grad1) .* d ./ mu;
Re2 = abs(grad2) .* d ./ mu;
Re3 = abs(grad3) .* d ./ mu;
Ar = (rho_p - rho_f) * g * D^3 ./ (mu);
A = 1 + 0.43*Ar^(0.57)*(1 - 2.4*(dp/D)^2.4);
n_R = (4.8 - 2.4*A)/(1+A);
Ut_R1 = Up1 ./ (e1.^n_R);
Ut_R2 = Up2 ./ (e2.^n_R);
Ut_R2 = Up3 ./ (e3.^n_R);
n1 = 2.78 - 2.72*log10(Re1);
n2 = 2.78 - 2.72*log10(Re2);
n3 = 2.78 - 2.72*log10(Re3);
plot(time,Up1,time,Up2,time,Up3);
legend('Up1','Up2','Up3');