Svingningssystem med fire masser og fem fjedre i serie.
> restart:with(DEtools):
> m1:=10:m2:=10:m3:=10:m4:=10:k1:=10:k2:=10:k3:=10:k4:=10:k5:=10:
> SvingSys := {m1*diff(s1(t), t$2)=-k1*s1(t)+k2*(s2(t)-s1(t)), m2*diff(s2(t),t$2)=-k2*(s2(t)-s1(t))+k3*(s3(t)-s2(t)), m3*diff(s3(t),t$2)=-k3*(s3(t)-s2(t))+k4*(s4(t)-s3(t)), m4*diff(s4(t),t$2)=-k4*(s4(t)-s3(t))-k5*s4(t)};
Begyndelsesbetingelser:
,
,
,
,
.
> simplify(dsolve(SvingSys union {s1(0)=1, D(s1)(0)=0, s2(0)=0, D(s2)(0)=0, s3(0)=0, D(s3)(0)=0, s4(0)=0, D(s4)(0)=0},{s1(t),s2(t),s3(t),s4(t)})):
> assign(%);
> 's1(t)'=s1(t);'s2(t)'=s2(t);'s3(t)'=s3(t);'s4(t)'=s4(t);
> plot([s1(t),s2(t),s3(t),s4(t)],t=0..40,s=-1..1,color=[red,blue,green,yellow], legend=["m1", "m2", "m3", "m4"]);
> with(plots):with(plottools):
Warning, the name changecoords has been redefined
Warning, the names arrow and translate have been redefined
> animation:=proc(funktion1,funktion2,funktion3,funktion4,sek) local funk1, funk2, funk3, funk4, ma, mb, mc, md, mabcd: funk1:=unapply(funktion1,t); funk2:=unapply(funktion2,t); funk3:=unapply(funktion3,t); funk4:=unapply(funktion4,t); ma:=t->translate(rectangle([0,0], [0.5,0.5],color=red),1.75+funk1(t),0); mb:=t->translate(rectangle([0,0], [0.5,0.5],color=blue),3.75+funk2(t),0);mc:=t->translate(rectangle([0,0], [0.5,0.5],color=green),5.75+funk3(t),0); md:=t->translate(rectangle([0,0], [0.5,0.5],color=yellow),7.75+funk4(t),0); mabcd:=t->display([ma(t/10),mb(t/10),mc(t/10),md(t/10)]); display(seq(mabcd(t),t=0..sek*10),scaling= constrained, view=[0..10,0..1], insequence=true); end :
> animation(s1(t),s2(t),s3(t),s4(t),20);
>