guictr

10 Reputation

2 Badges

6 years, 21 days

MaplePrimes Activity


These are replies submitted by guictr

@Preben Alsholm 

Now I have another problem. I'm trying to create an animation of the arm, which is basically a 3d double pendulum. I added the following lines:

 

noffm:= 100:
divs:=10:

for i from 0 to noffm do
aR10:= Matrix([ [1,0,0,0] , [0,cos(rhs(sol[2](i/divs))),-sin(rhs(sol[2](i/divs))),0] , [0,sin(rhs(sol[2](i/divs))),cos(rhs(sol[2](i/divs))),0] , [0,0,0,1] ]):
aR21:= Matrix([ [cos(rhs(sol[4](i/divs))),0,-sin(rhs(sol[4](i/divs))),0] , [0,1,0,0] , [sin(rhs(sol[4](i/divs))),0,cos(rhs(sol[4](i/divs))),0] , [0,0,0,1] ]):
aR32:= Matrix([ [cos(rhs(sol[6](i/divs))),sin(rhs(sol[6](i/divs))),0,0] , [-sin(rhs(sol[6](i/divs))),cos(rhs(sol[6](i/divs))),0,0] , [0,0,1,0] , [0,0,0,1] ]):
aR54:= Matrix([ [cos(rhs(sol[8](i/divs))),0,-sin(rhs(sol[8](i/divs))),0] , [0,1,0,0] , [sin(rhs(sol[8](i/divs))),0,cos(rhs(sol[8](i/divs))),0] , [0,0,0,1] ]):

aBr := aR10.aR21.aR32.T43:
aB1:=aBr[1,4] :
aB2:=aBr[2,4] :
aB3:=aBr[3,4] :
aBm1 := subs[eval](L1=1, L2=1, aB1):
aBm2 := subs[eval](L1=1, L2=1, aB2):
aBm3 := subs[eval](L1=1, L2=1, aB3):
aCr := aR10.aR21.aR32.aT43.aR54.aT76:
aC1:=aCr[1,4] :
aC2:=aCr[2,4] :
aC3:=aCr[3,4] :
aCm1 := subs[eval](L1=1, L2=1, aC1):
aCm2 := subs[eval](L1=1, L2=1, aC2):
aCm3 := subs[eval](L1=1, L2=1, aC3):


rod1[i] := line([0,0,0] , [aBm1,aBm2,aBm3]):
rod2[i] := line([aBm1,aBm2,aBm3] , [aCm1,aCm2,aCm3]):
ms0:= sphere([0,0,0], 0.02, color=green);
ms1[i] := sphere([aBm1,aBm2,aBm3], 0.02, color=blue):
ms2[i] := sphere([aCm1,aCm2,aCm3], 0.02, color=red):
anima[i] :=display({rod1[i], rod2[i],ms0, ms1[i], ms2[i]}):
end do:

display([seq(anima[i], i=0..noffm)], insequence=true, scaling=constrained);

 

But the animations is showing only one link of the arm. Am I doing something wrong here?

 

@Preben Alsholm 

Man, thank you so much! Those changes solved all the problems!

Page 1 of 1