function [F,G] = bi45t_lin(A,B,h,theta)
%
%  This function computes the F and G matrices of Backinterpolation
%  4/5, when used to simulate linear systems.
%
%         [F,G] = bi45t_lin(A,B,h,theta)
%
%  Input parameters:
%  -----------------
%
%     A     :=  System matrix of continuous-time system.
%
%     B     :=  Input matrix of continuous-time system.
%
%     h     :=  Desired step length, can be either positive or negative.
%
%     theta :=  Theta value to be used in the method.  The forward semi-step
%               integrates across theta*h time units, whereas the subsequent
%               backward semi-step integrates across the remaining (1-theta)*h
%               time units.
%
%  Output parameters:
%  ------------------
%
%     F     :=  System matrix of discrete-time system.
%
%     G     :=  Input matrix of discrete-time system.
%
%  Function calls:
%  ---------------
%
%  This function calls the function:
%
%           [F4,G4,F5,G5] = rkf45_lin(A,B,h)
%
%  to compute the forward and backward semi-steps composing the method.
%  It uses the 4th-order approximation, x4, during the forward semi-step,
%  and the 5th-order approximation, x5, during the backward semi-step.
%
h_left = theta*h;
h_right = (theta-1)*h;
[F4,G4,dummy1,dummy2] = rkf45_lin(A,B,h_left);
[dummy1,dummy2,F5,G5] = rkf45_lin(A,B,h_right);
F = F5\F4;
G = F5\(G4 - G5);
return