Code covered by the BSD License  

Highlights from
Runge Kutta DAE solver

Runge Kutta DAE solver



15 Jan 2013 (Updated )

Differential algebraic systems can be solved with an adapted Runge Kutta method.

getIdxFlatY( para )
function [ idxD idxA ] = getIdxFlatY( para )
%getIdxFlatY Think of the solution y ([M,N]=size(y)) as a flat vector.
% It indicates which variable is dynamic or algebraic.
% (length(iD)+length(iA)=M*N)
%INPUT para     struct  Internal rungekutta parameter.
%OUTPUT vector idxD  Indices of the dynamic variables.
%       vector idxA  Indices of the algebraic variables.
%AUTHOR Stefan Schie├čl
%DATE   13.08.2012

    dynPoints = para.dynPoints;
    idxDynamicEquations = para.idxDynamicEquations;
    idxAlgebraicEquations = para.idxAlgebraicEquations;
    cE = para.countEquations;
    cP = para.countPoints;

    idxD = [];
    idxA = [];
    for i=1:cP
        % If the point is not dynamic, just set everything to 
        % algebraic
        if (ismember(i, dynPoints) == 1)
            idxD = [idxD (i-1)*cE+idxDynamicEquations];    
            idxA = [idxA (i-1)*cE+idxAlgebraicEquations];    
            idxA = [idxA ((i-1)*cE+1):i*cE];    

Contact us