# MATLAB: Solving System of two Differential Equations with one initial and one end condition

initial and end conditionMATLABsystem of two differential equations

This is a code for the heat transfer in a heat exchanger. It solves the system of the two ODEs T_h_dx = … and T_c_dx = … for two initial conditions T_hot_in and T_cold_in.
How can this be solved, if T_cold_in should be the temperature at the end of the heat ecxhanger (x = length / end condition) and T_hot_in still the temperature at x = 0 (initial condition)?
Thank you!
% Functions for heat transfer to be solved by ode    function T_calc = heat_transfer(~,T)        T_h = T(1,1);        T_c = T(2,1);        T_h_dx = -1 / ((m_hot_plate  / 2) * c_water * R_width) * (T_h - T_c);                 T_c_dx =  1 / ((m_cold_plate / 2) * c_water * R_width) * (T_h - T_c);              T_calc = [T_h_dx ; T_c_dx];     end %__________________________________________________________________________                                                                                            % solve ODE System    [X, T_tot] = ode23(@(x,T) heat_transfer(x,T), [0 length],[T_hot_in T_cold_in]);

syms Th(x) Tc(x)m_hp = 20;m_cp = 5;cw = 1;Rw = 1;eq(1) = diff(Th,x) == -1 / ((m_hp / 2) * cw * Rw) * (Th - Tc);eq(2) = diff(Tc,x) ==  1 / ((m_cp / 2) * cw * Rw) * (Th - Tc);conds = [Tc(10) == 20, Th(0) == 50];sol = dsolve(eq,conds);fplot(sol.Tc,[0 10])hold onfplot(sol.Th,[0 10])hold off