% This function draws the flow of the static string 
% Input:  
%    y0 - the initial conditions in the form [Kc(0); y(0); Db(0); Df(0)]
%    lf - the length of the line of the flow
%    clr- the colour of the plot
%    solver- integration method: 0 - Runga Kutta; 1 - Adams-Bashforth-Moulton PECE;
%    2 - modified Rosenbrock formula; 3 - trapezoidal rule;
% Output: 
%    plot of the flow on the Kc-D plane and the value of renormalized
%    parameters
function flows = statEvalFlow(y0,lf,solver);
hold on;
lspan = 0:0.1:lf;

if length(y0) > 5
    eqmatrix = 'statFlowMatrix'
else
    eqmatrix = 'statRedFlowMatrix'
end

if solver==0
    [l,y]=ode45(eqmatrix, lspan, y0);
elseif solver==1
    [l,y]=ode113(eqmatrix, lspan, y0);
    
elseif solver==2
    [l,y]=ode23s(eqmatrix, lspan, y0);
elseif solver==3
    [l,y]=ode23t(eqmatrix, lspan, y0);
elseif solver==4
    [l,y]=ode23(eqmatrix, lspan, y0);
    end

S = size(y);

if length(y0) > 5
    Db = y(:,6);
else
    Db = y(:,4);
end

cut = 1;
while (cut<S(1)) & (Db(cut)<1)
    cut = cut + 1;
end
   
flows = [l(1:cut) y(1:cut,:)];