Closed BitNide closed 6 years ago
Thanks a lot for pointing that out. I was looking at what I did wrong in that exercise at this very moment!
I think it will fix the problem I had thanks! I will do a double check an push the new version tomorrow!
If you see another error let me know I checked every script up till 7 still need to check 8 9 and 10.
if you also remove the gravity the plots should also be good 👍
It is indeed working! I just pushed the new version including a modification of your animation script to the GitHub. Thanks for pointing out my error!
Hey man, When you look at the Y values you will find a sudden jump from your initial conditions. When simulating the motion using:
y = q_RK4.';
g = figure(1); filename = 'testAnimated.gif'; for n=1:length(y)-1 figure(1) line([0, 0.2cos(y(1,n))],[0.3, 0.3+0.2sin(y(1,n))]) line([0, 0.7cos(y(2,n))],[0, 0.7sin(y(2,n))]) line([0.7cos(y(2,n)), 0.7cos(y(2,n))+ cos(y(3,n))0.6],[0.7sin(y(2,n)), 0.7sin(y(2,n))+sin(y(3,n))0.6]) xlim([-1.5 1]) ylim([0 1]) drawnow frame = getframe(g); im = frame2im(frame); [imind,cm] = rgb2ind(im,256); if n == 1 imwrite(imind,cm,filename,'gif', 'Loopcount',inf); else imwrite(imind,cm,filename,'gif','WriteMode','append'); end clf end
I found that you incorrectly formulated the constraint relation between phi4 and point A. you are currently using: -parms.O4Acos(phi4)+parms.O2Acos(phi2) First off this does not amount to a total of 0. Secondly it fails to acknowledge the vertical shift of the slider and thus lenght variation of O4A.
I replaced it with: -y3cos(phi4)+x3sin(phi4)
This correctly incorporates the relation both horizontal and vertical and will provide better results: