% This function draws the flow of the rigid string 
% Input:  
%    y0 - the initial conditions in the form [Kc(0); y(0); eta(0); lambda(0)]
%    lf - the length of the line of the flow
%    u  - vector of real space
%    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 = gaussEvalFlow(y0,lspan,solver);
eqmatrix = 'gausFullMatrix';

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

S = size(y);
lSize = S(1);
N = S(2)-7;
k = (2*pi/N)*(0:N-1);
Dk = y(:,8:S(2));
for i = 1:lSize
    for j=1:N
        %Du(i,j) = y(i,5).*sum(Dk(i,:).*cos(k.*(j-1)))/N;
        Du(i,j) = sum(Dk(i,:).*cos(k.*(j-1)))/N;
    end
end

flows = [l y Du];