Student Support Forum: 'Animation problem' topicStudent Support Forum > General > Archives > "Animation problem"

 Next Comment > Help | Reply To Topic
 Author Comment/Response Frank Rotello 04/25/99 09:30am Attached is a Mathmatica program that uses a FOR loop to animate a linkagemechanism. But there is an error that states Graphics::gprim: primitive Null encountered. Whats going on? (* Mathematica program to draw and animate the position of the mechanism in Ex. 1; also draw the curves for the centers of mass of links 2 and 4*) Apply [Clear, Names [ ''Global`*'']]; (* Set system parameters and the number (nox) of positions to draw *) In[22]:= fi=N[Pi/4] AB= .15 BC=.4 CD=.37 CE=.23 xd = .3 yd = .45 Lc =CD EF= CE La= 0.3 Lb=.45    pi= N [Pi] nox=24 (* draw nox position of the mechanism *) Out[22]= 0.785398 Out[23]= 0.15 Out[24]= 0.4 Out[25]= 0.37 Out[26]= 0.23 Out[27]= 0.3 Out[28]= 0.45 Out[29]= 0.37 Out[30]= 0.23 Out[31]= 0.3 Out[32]= 0.45 Out[33]= 3.14159 Out[34]= 24 In[35]:= For[increment = 1, increment<=nox, increment++,       fi=(increment-1)*pi*2/nox;        (* the position of the joint B *)    yb= AB*Sin[fi]; xb= AB*Cos[fi];    (*the position of the joint C *) xd = La ;    yd =Lb;    eq23a=( xc -xb )^2 + ( yc-yb)^2- BC^2; eq23b=( xc-xd )^2+ ( yc-yd )^2-CD^2; solution=Solve [ {eq23a==0,eq23b==0},{xc,yc}]; (* there are two possible solutions for C *) xc1=xc/.solution[[1]]; yc1=yc/.solution[[1]];    xc2=xc/.solution[[2]];    yc2=yc/.solution[[2]];    (*Use the constraints to select the leftmost solution *)    If [xc1 Automatic, PlotRange->       {{-.42, .362}, {-.2,.75}}]; ] (* End of the FOR loop *) Graphics::''gprim'': ''Unknown \!\(Graphics\) primitive \!\(Null\) encountered.'' From In[35]:= URL: ,

 Subject (listing for 'Animation problem') Author Date Posted Animation problem Frank Rotello 04/25/99 09:30am Re: Animation problem P.J. Hinton 04/26/99 12:11pm
 Next Comment > Help | Reply To Topic