how to plot graph for U wrt L_lime from 0.001 to 0.003 with differance 0.001? getting error using / matrix dimension must agree. the value of L_lime changes U value

2 views (last 30 days)
di=0.01;
do=0.025;
hi=5000;
m_dot = 0.3;
k= 0.598;
rho=998;
knew=1.004*10^-6;
pr=7.01;
dh=do-di
dh = 0.0150
Ac = pi*((do^2)-(di^2))/4
Ac = 4.1233e-04
vel=m_dot/(rho*Ac)
vel = 0.7290
Re=(vel*dh)/knew
Re = 1.0892e+04
if Re>4000
Nu=0.023*(Re^0.8)*(pr^0.4)
end
Nu = 85.0539
ho= (k*Nu)/dh
ho = 3.3908e+03
k_lime=1.3;
L_lime = [0.001:0.003:0.0001];
U=(1/((1/hi)+(L_lime/k_lime)+(1/ho)))
Error using /
Matrix dimensions must agree.

Accepted Answer

Diwakar Diwakar
Diwakar Diwakar on 5 Jun 2023
To perform the division between L_lime and k_lime, you need to ensure that their dimensions match. If you want to divide each element of L_lime by k_lime, you can use element-wise division by adding a dot before the slash operator.
Try this code:
di = 0.01;
do = 0.025;
hi = 5000;
m_dot = 0.3;
k = 0.598;
rho = 998;
knew = 1.004 * 10^-6;
pr = 7.01;
dh = do - di;
Ac = pi * ((do^2) - (di^2)) / 4;
vel = m_dot / (rho * Ac);
Re = (vel * dh) / knew;
if Re > 4000
Nu = 0.023 * (Re^0.8) * (pr^0.4);
else
Nu = 0; % Set Nu to zero if Re is not greater than 4000
end
ho = (k * Nu) / dh;
k_lime = 1.3;
L_lime = 0.001:0.003:0.0001;
U = (1 ./ ((1 ./ hi) + (L_lime ./ k_lime) + (1 ./ ho)));

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!