function Q1 = FbLin(x,u,d,p,v2)

%% Parameters
F     = p(1);                                                    % flowrate
m1    = p(2);                                           % hold up in tank 1
m2    = p(3);                                            % holdup in tank 2
cp    = p(4);                                               % specific heat


%% States
T1 = x(1);                                          % temperature in tank 1
T2 = x(2);                                          % temperature in tank 2

%% Disturbances
T0 = d(1);                                    % inlet temperature to tank 1
Q2 = d(2);                                                 % heat to tank 2

% Calculate input
L2fhx   =  -F^2/(m1*m2)*T1 + F^2/m2^2*(T2-T1);
Lp1Lfhx = F^2/(m1*m2);
Lp2Lfhx = -F/(m2*m2*cp);
LgLfhx  = F/(m1*m2*cp);

Q1      = (v2 - L2fhx - Lp1Lfhx*T0 - Lp2Lfhx*Q2 ) / LgLfhx; 

end