clear

valg=1;
h=.1;
x=0:h:25;
y=zeros(length(x),1);
y(1)=.1;

%eksplisitt euler
if valg==1
    for i = 1:length(x)-1
        y(i+1)=y(i)+h*(y(i)^2-y(i)^3);
    end
end

%implisitt euler
if valg==2
    for i = 1:length(x)-1
        %y(i) som startgjetning
        z=y(i);
        for j=1:10
            z=z-(z-y(i)+h*(3*z+exp(z)))/(1-h*(3+exp(z)));
        end
        y(i+1)=z;
    end
end

plot(x,y)
disp(y(end))
    



