DeustoTech / DyCon-toolbox

The dycon platform is a collection of common tools for the investigation of differential equations, in the context of the development of the Dycon project.
http://cmc.deusto.eus/dycon/
2 stars 2 forks source link

Minor bug: manual numeric ode schemes #36

Open narmko opened 5 years ago

narmko commented 5 years ago

For instance, it works:

function [tline,yline] = Euler(odefun,tspan,y0,options)
    tline = tspan;
    yline = zeros(length(tspan),length(y0));
    yline(1,:) = y0;

    for i=1:length(tspan)-1
        vector = odefun(tline(i),yline(i,:)')';
        yline(i+1,:) = yline(i,:) + vector*(tline(i+1)-tline(i));
    end        
end

However, in the odefun(), odefun(tline(i),yline(i,:)')'; the need of double transpose is strange since it requires an ode scheme to produce row vectors of states variables.