Google ClassroomGoogle Classroom
GeoGebraGeoGebra Classroom

Testing data in GGB classic desktop

Script Setup

#================================================================ # Data and Setup #================================================================ LP = {(0.154, 0.055), (0.204, 0.055), (0.254, 0.055), (0.104, 0.105), (0.154, 0.105), (0.204, 0.105), (0.254, 0.105), (0.304, 0.105), (0.354, 0.105), (0.104, 0.155), (0.154, 0.155), (0.204, 0.155), (0.254, 0.155), (0.304, 0.155), (0.354, 0.155), (0.404, 0.155), (0.454, 0.155), (0.104, 0.205), (0.154, 0.205), (0.204, 0.205), (0.254, 0.205), (0.304, 0.205), (0.354, 0.205), (0.404, 0.205), (0.454, 0.205), (0.504, 0.205), (0.554, 0.205), (0.604, 0.205), (0.104, 0.255), (0.154, 0.255), (0.204, 0.255), (0.254, 0.255), (0.304, 0.255), (0.354, 0.255), (0.404, 0.255), (0.454, 0.255), (0.504, 0.255), (0.554, 0.255), (0.604, 0.255), (0.654, 0.255), (0.704, 0.255), (0.054, 0.305), (0.104, 0.305), (0.154, 0.305), (0.204, 0.305), (0.254, 0.305), (0.304, 0.305), (0.354, 0.305), (0.404, 0.305), (0.454, 0.305), (0.504, 0.305), (0.554, 0.305), (0.604, 0.305), (0.654, 0.305), (0.054, 0.355), (0.104, 0.355), (0.154, 0.355), (0.204, 0.355), (0.254, 0.355), (0.304, 0.355), (0.354, 0.355), (0.404, 0.355), (0.454, 0.355), (0.504, 0.355), (0.554, 0.355), (0.604, 0.355), (0.054, 0.405), (0.104, 0.405), (0.154, 0.405), (0.204, 0.405), (0.254, 0.405), (0.304, 0.405), (0.354, 0.405), (0.404, 0.405), (0.454, 0.405), (0.504, 0.405), (0.554, 0.405), (0.054, 0.455), (0.104, 0.455), (0.154, 0.455), (0.204, 0.455), (0.254, 0.455), (0.304, 0.455), (0.354, 0.455), (0.404, 0.455), (0.454, 0.455), (0.504, 0.455), (0.054, 0.505), (0.104, 0.505), (0.154, 0.505), (0.204, 0.505), (0.254, 0.505), (0.304, 0.505), (0.354, 0.505), (0.404, 0.505), (0.454, 0.505), (0.054, 0.555), (0.104, 0.555), (0.154, 0.555), (0.204, 0.555), (0.254, 0.555), (0.304, 0.555), (0.354, 0.555), (0.404, 0.555), (0.054, 0.605), (0.104, 0.605), (0.154, 0.605), (0.204, 0.605), (0.254, 0.605), (0.304, 0.605), (0.354, 0.605), (0.054, 0.655), (0.104, 0.655), (0.154, 0.655), (0.204, 0.655), (0.254, 0.655), (0.304, 0.655), (0.054, 0.705), (0.104, 0.705), (0.154, 0.705), (0.204, 0.705), (0.254, 0.705), (0.054, 0.755), (0.104, 0.755), (0.154, 0.755), (0.204, 0.755), (0.054, 0.805), (0.104, 0.805), (0.154, 0.805)} N = Length(LP) LN = Sequence(N) #================================================================ # Shift zero-frequency component to center of spectrum. #================================================================ Lk = LN-1-Div(N,2) #================================================================ # Calculate DFT: LF is a list of frequencies #================================================================ LF = 1/N*Zip(Sum(Zip( (abs(P);arg(P)-2*pi*k*(n-1)/N), P,LP, n,LN)), k,Lk) #================================================================ # Lj : frequency index sorted by size (abs) #================================================================ LAs= Reverse(Sort(Zip((abs(F),n), F,LF, n,LN ))) Lj = Zip( y(As), As,LAs) #================================================================ # Use the first M greatest frequencies #================================================================ M = Slider(1, N, 1, 1, 160, false, true, false, false) SetValue(M, N) Lm = Sequence(1, M) Lks= First(Zip( Element(Lk,j), j,Lj),M) LFs= First(Zip( Element(LF,j), j,Lj),M) LRs= First(Zip( x(As), As,LAs),M) #================================================================ # Plot M epicycles #================================================================ t = Slider(0, 2*pi, 0.0099, 0.5, 150, false, true, false, false) LC1= Zip( Sum( Zip( (abs(F);arg(F)+k*t), F,First(LFs,m), k,Lks) ), m,Lm ) LC = Join({(0,0)}, LC1) Plast = Last(LC) PolyL = Polyline(LC) Epicycles = Zip( Circle(Element(LC, m),R), m,Lm, R,LRs ) #================================================================ # Parametric curve: Inverse of Discrete Fourier Transform #================================================================ fx(x) = Sum( Zip( x(F)*cos(k*x) - y(F)*sin(k*x), F,LFs, k,Lks) ) fy(x) = Sum( Zip( x(F)*sin(k*x) + y(F)*cos(k*x), F,LFs, k,Lks) ) orbit = Curve(fx(t), fy(t), t, 0, 2 pi) #================================================================ # Settings #================================================================ SetValue(t,0) StartAnimation(t, true) SetVisibleInView(LF , 1, false) SetVisibleInView(LAs, 1, false) SetVisibleInView(LFs, 1, false) SetVisibleInView(LC1, 1, false) SetVisibleInView(LC , 1, false) SetVisibleInView(fx , 1, false) SetVisibleInView(fy , 1, false) ShowLabel(PolyL, false) ShowLabel(orbit, false)