Filter löschen
Filter löschen

How can I put Tn(n+1) and Tn(n-1) values into diff equations?

2 Ansichten (letzte 30 Tage)
Martin Pecha
Martin Pecha am 4 Mai 2018
Bearbeitet: Martin Pecha am 4 Mai 2018
I need to calculate system of equations for transport of heat between the cells - total number of cells is Ncell=19. Problem is that every cell in calculation is taking heat from cell(n-1) and cell(n+1). How can I write it down if these values are basically not calculated before? Is it possible to write it as a matrix where I choose specific values for Tn+1 and Tn-1?
dTdt(3) and dTdt(3+ncell+1) are the edge cells where one part interacts with T of air dTdt(4:3+ncell) are the one I need to write correctly where ncell are the inner cells (Ncell-2)
%parameters
Tinp=T(1);
Tinn=T(2);
T1=T(3);
Tn=T(4:3+ncell);
TN=(3+ncell+1);
Toutp=(4+ncell+1:4+2*ncell)';
Toutn=(4+2*ncell+1:4+3*ncell)';
Ttp=(4+3*ncell+1);
Ttn=(4+3*ncell+2);
TSoutp=1/ncell*(+sum(Toutp));
TSoutn=1/ncell*(+sum(Toutn));
Tnplus1=[Tn(2:17);TN]; %This is how I tried to write it
Tnminus1=[T1;Tn(1:16)]; %This is how I tried to write it
cTV2=y(1);
cTV3=y(2);
cTV4=y(3);
cTV5=y(4);
cCV2n=y(5:4+Ncell);
cCV3p=y(4+Ncell+1:4+2*Ncell);
cCV3n=y(4+2*Ncell+1:4+3*Ncell);
cCV4p=y(4+3*Ncell+1:4+4*Ncell);
cCV4n=y(4+4*Ncell+1:4+5*Ncell);
cCV5p=y(4+5*Ncell+1:4+6*Ncell);
dTdt=zeros(4+3*ncell+4,1);
% mass tank balance
dTdt(1)=(rho*Cp*QS*(Ttinp-Tinp)+Up*Ncell*Ap*(Tair-Tinp)+Wpump)/(rho*Cp*Vp*Ncell);
dTdt(2)=(rho*Cp*QS*(Ttinn-Tinn)+Up*Ncell*Ap*(Tair-Tinn)+Wpump)/(rho*Cp*Vp*Ncell);
%mass cell balance
dTdt(3)=(rho*Cp*QC*(Tinp-T1)+rho*Cp*QC*(Tinn-T1)+Ux*Ax*(T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orien

Mehr zu Heat and Mass Transfer 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!

Translated by