How to multiply matrix by using for loop
Show older comments
I am trying to calculate heat for 3 different stages and I have written my 3 cases in the form of a matrix. I want to get the final Q with all 3 stages but I am getting only first one calculated.
Qhc = 2000000*1000;%J , potrebna energija za grijanje u jednom satu
N = 200; %broj VK
Qg = Qhc/3600;
t = 3600; %vrijeme
Tz1 = 20; %°C
Tw1g = 50; %°C
Tw1h = 7; %°C
cpz = 1050; %J/kgK
cpw = 4187; %J/kgK
roz = 1.225; %kg/m3
row = 997; %kg/m3
Vw = 488 / ( 3600 * 1000 ); %m3/s protok vode
Cmax = row * Vw * cpw;
kA = [97.50664 156.195 234.9065]; %W/m2K
Vz = [ 340/3600 510/3600 680/3600 ]; %m3/s
Pvent = [ 11.99605 17.38172 29 ]; %W
Q = [ 0 0 0 ];
Qvk = 0;
P = 0;
for i = 1:length(Vz)
Cmin(i) = roz * Vz(i) * cpz; %W/K
NTU(i) = kA(i) / Cmin(i);
C(i) = Cmin(i) / Cmax;
eta(i) = NTU(i) .^ (-0.22);
epsilon(i) = 1 - exp ((1/(C(i)*eta(i))*(exp(-NTU(i)*C(i)*eta(i))-1)));
if Qhc > 0
Q(i) = Cmin(i) * epsilon(i) * (Tw1g - Tz1);
Q_J(i) = Q(i) * 3600; %energija koju preda u jednom satu
elseif Qhc < 0
Q(i) = Cmin(i) * epsilon(i) * (Tz1 - Tw1h);
Q_J(i) = Q(i) * 3600; %energija koju preda u jednom satu
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements 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!