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)
MATLAB License Number: 40875211
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)
Simulink Version 10.1 (R2020a)
Optimization Toolbox Version 8.5 (R2020a)
Statistics and Machine Learning Toolbox Version 11.7 (R2020a)
Symbolic Math Toolbox
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)
clf
end
hold on
axis equal
axis([-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))];
end
end