# MATLAB: Ode45 fail with pendulum

ode45pendulum

Hello. I have proof that in my machine the pendulum goes all the way around, contradicting reality. Any thoughts?
—————————————————————————————————–
MATLAB Version: 9.8.0.1323502 (R2020a)
Operating System: Microsoft Windows 8.1 Version 6.3 (Build 9600)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
—————————————————————————————————–
MATLAB Version 9.8 (R2020a)
function pendule2[~,y]=ode45(@fun,0:0.05:40,[pi-0.1,0]);figure(1)close(1)figure(1)[n,~]=size(y);t1=0:0.05:2*pi;x1=cos(t1);y1=1+sin(t1);for k=1:n    hold on    axis equal    axis([-1 1 0 2])    plot(x1,y1,'k--')    plot(sin(y(k,1)),1-cos(y(k,1)),...        'bo','MarkerSize',5,'MarkerFaceColor','b')    plot([0 sin(y(k,1))], [1 1-cos(y(k,1))],'b')    pause(0.01)    clfendhold onaxis equalaxis([-1 1 0 2])plot(x1,y1,'k--')plot(sin(y(n,1)),1-cos(y(n,1)),...    'bo','MarkerSize',5,'MarkerFaceColor','b')plot([0 sin(y(n,1))], [1 1-cos(y(n,1))],'b')text(0.85,0.1,'end')    function [dydt]=fun(~,y)        dydt=[y(2); -sin(y(1))];    endend
options = odeset('RelTol',1e-10);[~,y]   = ode45(@fun,0:0.05:40,[pi-0.1,0],options);