rickstaa / MBD-B

This repository contains the codes I wrote for the course MBDB during my master Biomechanical design It contains my solutions to the course assignments.
MIT License
1 stars 0 forks source link

HW7 incorrect constraint #2

Closed BitNide closed 6 years ago

BitNide commented 6 years ago

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

incorrectc

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: testanimated

rickstaa commented 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!

rickstaa commented 6 years ago

I think it will fix the problem I had thanks! I will do a double check an push the new version tomorrow!

rickstaa commented 6 years ago

If you see another error let me know I checked every script up till 7 still need to check 8 9 and 10.

BitNide commented 6 years ago

if you also remove the gravity the plots should also be good 👍

rickstaa commented 6 years ago

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!