Error: Inner Matrix dimensions must agree
1 次查看(过去 30 天)
显示 更早的评论
%function [Qr] = Lobo(d0, L, nb)
clc
d0 = 0.06:0.01:0.27;
Xmat1 = zeros(numel(d0),1);
for i = 1:numel(d0)
%variables
%d0 = 0.19;
L =12.14;
nb = 8;
%input data
Ti = 525.05; %Fluid in degK
T0 = 659.25; %Fluid/gas out degK
cpfluid = 1.95; %Cp fluid KJ/kgdegK (Crude)
%mfluid = 255.5; %flowrate fluid kg/s
THD = mfluid*cpfluid*(T0 - Ti);%Total Heat Duty
Ef = 0.9320; %Fuel efficiency
Qfuel = THD/Ef;%Heat released by fuel Kw
LHV = 52300; %Fuel value KJ/kg
mfuel = Qfuel/LHV;
ea = 0.15;
Qfuel
disp(Qfuel);
mfuel
disp(mfuel);
%absorptivity
alpha = 0.9;
%ctc
x = (0.012*d0/0.026) + d0;
x
disp(x);
%Flame calculation
cpsteam = 4.1855;
cpco2 = 0.918;
cpn2 = 1.044;
xco2 = 0.054;
xsteam = 0.034; %Total should be 8.8
xn2 = 0.912;
Dco2 = 24*10^-4;
Dsteam = 14*10^-4;
Dn2 = 0.158*10^-4;
cpgas = xsteam*cpsteam + xco2*cpco2;
cpgas
disp(cpgas);
kgas = 0.25*10^-3; %Thermal conductivity
musteam = 7.58*(10^-5);
muco2 = 3.74*(10^-5);
mugas = xsteam*cpsteam + xco2*cpco2; %viscosity of gas
atfr = 3.625; %in notebook
mair = mfuel*(atfr*(1+ea));
mair
disp(mair);
cpair = 1.013;
mgas = mfuel*(1+atfr*(1+ea));
Lf = 2.5.*(Qfuel./(nb.*1000)); %flame length
Lf
disp(Lf);
tf = (0.235.*(Qfuel.^(2/5)) - Lf)./1.02; %flame size
tf
disp(tf);
db = 1.5*tf; %Burner tile diameter
db
disp(db);
cb = Qfuel*0.086/1000;
cb
disp(cb);
dbc = (db + cb)./sind(180./nb); %Burner circle diameter
dbc
disp(dbc);
%Heat transfer coefficient
t = 0.005; %Tube thickness
rf = 0.5*(10^-3); %roughness factor
di = d0 - t;
kw = 23*(10^-3); %Thermal conductivity of the wall
k = 0.25*(10^-3); %Thermal conductivity
%rof = 1320; %density
mu = 130; %Viscosity Pa-s
Ai = (pi*(di.^2))./4;
A0 = (pi*(d0.^2))./4;
dk = (d0).*(1/kgas);
dm = d0.*(1/mugas);
dA = dm(:)*(pi*(d0.^2))./4;
h0 = dk(:)*0.023*((mgas*dA).^0.8).*((cpgas.*mugas./kgas)).^0.3;
hi = ((di./k).*(0.023.*((mfluid.*di./mu.*Ai).^0.8).*((cpfluid.*mu/k)).^0.3));
Ui = ((1./hi) + t./(kw) + rf).^-1; %Overall heat transfer coefficient
h0
disp(h0);
hi
disp(hi);
Ui
disp(Ui);
%Cold plane area
cbt = (Qfuel*1.055/(4*10^3)) + 1.5;
dtc = cbt + dbc; %tube circle diameter
ntubes = pi.*dtc./x;
cbt
disp(cbt);
dtc
disp(dtc);
n1 = (ntubes(:)*L);
ntubes
disp(ntubes);
Ar = x*n1;
Ar
disp(Ar);
%Exchange factor
L2 = L.*L;
LLf = L2(:)*Lf;
F = 4*pi*LLf/(dtc.^3);
F
disp(F);
%Gas temperature
Tfin = 298.15; %Flame inlet temperature
Lh = 510; %Latent heat of vapourization of Natural gas
Tg = Tfin + (Lh*mfuel/(mgas*cpgas));
Tg
disp(Tg);
%Tube wall temperature
Tavg = (Ti +T0)/2;
C = (h0.*A0)/(hi.*Ai);
Tw = (Tg.*C + Tavg)./(1 + C);
Tw
disp(Tw);
%Radiant heat flux
stef = 5.67*10^-8; %Stefan-Boltzmann constant
Tg4 = Tg.*Tg.*Tg.*Tg;
Tw4 = Tw.*Tw.*Tw.*Tw;
dT4 = Tg4(:,1) - Tw4(:,1);
dT = Tg(:,1) - Tw(:,1);
qr = stef*alpha*F(:)*(dT4) + Ui.*(dT);
qr
disp(qr);
%Heat leaving
Qr = qr * Ar; %total radiant heat absorbed
qout = abs(THD - Qr);
THD
disp(THD);
Qr
disp(Qr);
qout
disp(qout);
%heat balance
Qloss = 0.05*Qfuel;
Qair = mair*cpair*(298);
Qout = Qfuel + Qair - (Qr + Qloss);
qdiff = abs(qout - Qout);
Qout
disp(Qout);
qdiff
disp(qdiff);
%Total head produced
Re = mfluid*di/(Ai*mu);
v0 = Re.*mu./di;
if Re <= 2200
f = 64./Re; %friction factor
else
I = -2*log(((rf./di)./3.7) + 12./Re);
J = -2*log(((rf./di)./3.7) + 2.51*I./Re);
K = -2*log(((rf./di)./3.7) + 2.51*J./Re);
f = (I - ((J - I)^2)./(K - 2*J + I)).^-2; %friction factor
end
dH = 4.*f.*L.*v0.*v0./(2.*dtc); %Total head
f
disp(f);
dH
disp(dH);
disp(Qr);
THD
disp(THD);
qout
disp(qout);
Xmat1(i) = tf(i);
%Xmat2(i) = Lf(i);
end
plot(d0, Xmat1(:));
%end
Error:
Error using *
Inner matrix dimensions must agree.
Error in Lobo (line 91)
h0 = dk(:)*0.023*((mgas*dA).^0.8).*((cpgas.*mugas./kgas)).^0.3;
回答(2 个)
Torsten
2018-4-10
dk(:) is (22x1), dA is (22x22). Thus the multiplication dk(:)*...dA in h0=... is not defined.
Best wishes
Torsten.
0 个评论
Aletta Wilbrink
2018-4-10
You get this error because your dk and dA are not the same size
dk is a 1x22 double en dA is a 22x22 double.
You should check what exactly you want to multiply
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Thermal Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!