function [t,X] = PlatenVectorized(X0,g0,g,tspan,h,dW)
%Platen scheme of strong order one to approximate the solution of 
%dX=g_0(X)dt + g{1}(X)dW{1} on the time interval tspan with step size h, 
%Wiener increments dW and initial value X0

%number of stochastic integrals
M=length(g);
if M>1
    error('The Platen method is only implemented for a single stochastic integral')
end

% Create temporal grid
t = tspan(1):h:tspan(2);
n = length(t);

%Initialise solution
X = repmat(X0,[1,size(dW{1},2)]);

%do time stepping with Platen 1.0

for i = 2:n
    %Calculate stage values
    % H1
    H1 = X;
    g0H1 = g0(H1);      g1H1 = g{1}(H1); 
    % H2
    H2 = X + g0H1*h + g1H1*sqrt(h);
                        g1H2 = g{1}(H2);
    % approximation at next time point
    X = X + g0H1*h + g1H1.*dW{1}(i-1,:)... % Euler
                   + 1/2*(g1H2 - g1H1).*(dW{1}(i-1,:).^2 - h)/sqrt(h);
end