function y = Brobekk_HE_fsolve_fun(x,par)

% Variables
Th(1) = x(1);       Q(1) = x(11);       Tc(1) = x(21);
Th(2) = x(2);       Q(2) = x(12);       Tc(2) = x(22);
Th(3) = x(3);       Q(3) = x(13);       Tc(3) = x(23);
Th(4) = x(4);       Q(4) = x(14);       Tc(4) = x(24);
Th(5) = x(5);       Q(5) = x(15);       Tc(5) = x(25);
Th(6) = x(6);       Q(6) = x(16);       Tc(6) = x(26);
Th(7) = x(7);       Q(7) = x(17);       Tc(7) = x(27);
Th(8) = x(8);       Q(8) = x(18);       Tc(8) = x(28);
Th(9) = x(9);       Q(9) = x(19);       Tc(9) = x(29);
Th(10) = x(10);     Q(10) = x(20);      Tc(10) = x(30);

% Parameters
Th_in = par(1);
Tc_in = par(2);
UA_cell = par(3);
FB = par(4);
FV = par(5);

% Equations
y = [Q(1) - UA_cell*(Th(1)-Tc(10));
     Q(2) - UA_cell*(Th(2)-Tc(9));
     Q(3) - UA_cell*(Th(3)-Tc(8));
     Q(4) - UA_cell*(Th(4)-Tc(7));
     Q(5) - UA_cell*(Th(5)-Tc(6));
     Q(6) - UA_cell*(Th(6)-Tc(5));
     Q(7) - UA_cell*(Th(7)-Tc(4));
     Q(8) - UA_cell*(Th(8)-Tc(3));
     Q(9) - UA_cell*(Th(9)-Tc(2));
     Q(10) - UA_cell*(Th(10)-Tc(1));
     Q(1) - (FV*Cp_water(Tc(10))/3600)*(Tc(10)-Tc(9));
     Q(2) - (FV*Cp_water(Tc(9))/3600)*(Tc(9)-Tc(8));
     Q(3) - (FV*Cp_water(Tc(8))/3600)*(Tc(8)-Tc(7));
     Q(4) - (FV*Cp_water(Tc(7))/3600)*(Tc(7)-Tc(6));
     Q(5) - (FV*Cp_water(Tc(6))/3600)*(Tc(6)-Tc(5));
     Q(6) - (FV*Cp_water(Tc(5))/3600)*(Tc(5)-Tc(4));
     Q(7) - (FV*Cp_water(Tc(4))/3600)*(Tc(4)-Tc(3));
     Q(8) - (FV*Cp_water(Tc(3))/3600)*(Tc(3)-Tc(2));
     Q(9) - (FV*Cp_water(Tc(2))/3600)*(Tc(2)-Tc(1));
     Q(10) - (FV*Cp_water(Tc(1))/3600)*(Tc(1)-Tc_in);
     Q(1) - (FB*Cp_water(Th(1))/3600)*(Th_in-Th(1));
     Q(2) - (FB*Cp_water(Th(2))/3600)*(Th(1)-Th(2));
     Q(3) - (FB*Cp_water(Th(3))/3600)*(Th(2)-Th(3));
     Q(4) - (FB*Cp_water(Th(4))/3600)*(Th(3)-Th(4));
     Q(5) - (FB*Cp_water(Th(5))/3600)*(Th(4)-Th(5));
     Q(6) - (FB*Cp_water(Th(6))/3600)*(Th(5)-Th(6));
     Q(7) - (FB*Cp_water(Th(7))/3600)*(Th(6)-Th(7));
     Q(8) - (FB*Cp_water(Th(8))/3600)*(Th(7)-Th(8));
     Q(9) - (FB*Cp_water(Th(9))/3600)*(Th(8)-Th(9));
     Q(10) - (FB*Cp_water(Th(10))/3600)*(Th(9)-Th(10))];