4

so I'm trying to animate a 3D plot using the animate package but for some reason I can't get the animation to work.

enter image description here

Im trying to animate this image with controls, so one can see how the spiral is being created over time. Is there an efficient way to do this?

\documentclass[tikz]{standalone}
\usepackage{animate}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}
 \begin{axis}[grid = major]
   \addplot3 [surf, color = blue, mark=none]
   table[y=t, x=u_C, z=i_L] {
       t   u_C   i_L
       0.000000e+00    1.025483e-02    5.127415e-05
       1.000000e-02    1.067231e-02    1.559099e-04
       2.000000e-02    1.089647e-02    2.637538e-04
       3.000000e-02    1.091086e-02    3.727904e-04
       4.000000e-02    1.070236e-02    4.808566e-04
       5.000000e-02    1.026160e-02    5.856764e-04
       6.000000e-02    9.583387e-03    6.849013e-04
       7.000000e-02    8.667108e-03    7.761538e-04
       8.000000e-02    7.516976e-03    8.570742e-04
       9.000000e-02    6.142264e-03    9.253704e-04
       1.000000e-01    4.557415e-03    9.788688e-04
       1.100000e-01    2.782068e-03    1.015566e-03
       1.200000e-01    8.409701e-04    1.033681e-03
       1.300000e-01    -1.236215e-03   1.031705e-03
       1.400000e-01    -3.415216e-03   1.008448e-03
       1.500000e-01    -5.657576e-03   9.630841e-04
       1.600000e-01    -7.921179e-03   8.951903e-04
       1.700000e-01    -1.016090e-02   8.047799e-04
       1.800000e-01    -1.232933e-02   6.923288e-04
       1.900000e-01    -1.437762e-02   5.587940e-04
       2.000000e-01    -1.625642e-02   4.056238e-04
       2.100000e-01    -1.791680e-02   2.347577e-04
       2.200000e-01    -1.931133e-02   4.861710e-05
       2.300000e-01    -2.039514e-02   -1.499153e-04
       2.400000e-01    -2.112699e-02   -3.575259e-04
       2.500000e-01    -2.147032e-02   -5.705125e-04
       2.600000e-01    -2.139432e-02   -7.848357e-04
       2.700000e-01    -2.087488e-02   -9.961817e-04
       2.800000e-01    -1.989552e-02   -1.200034e-03
       2.900000e-01    -1.844818e-02   -1.391752e-03
       3.000000e-01    -1.653390e-02   -1.566663e-03
       3.100000e-01    -1.416335e-02   -1.720149e-03
       3.200000e-01    -1.135722e-02   -1.847752e-03
       3.300000e-01    -8.146375e-03   -1.945270e-03
       3.400000e-01    -4.571887e-03   -2.008861e-03
       3.500000e-01    -6.847962e-04   -2.035145e-03
       3.600000e-01    3.454317e-03    -2.021297e-03
       3.700000e-01    7.775987e-03    -1.965145e-03
       3.800000e-01    1.220274e-02    -1.865252e-03
       3.900000e-01    1.665020e-02    -1.720987e-03
       4.000000e-01    2.102837e-02    -1.532594e-03
       4.100000e-01    2.524319e-02    -1.301236e-03
       4.200000e-01    2.919817e-02    -1.029030e-03
       4.300000e-01    3.279623e-02    -7.190575e-04
       4.400000e-01    3.594173e-02    -3.753677e-04
       4.500000e-01    3.854242e-02    -2.947034e-06
       4.600000e-01    4.051163e-02    3.923232e-04
       4.700000e-01    4.177037e-02    8.037332e-04
       4.800000e-01    4.224938e-02    1.223832e-03
       4.900000e-01    4.189119e-02    1.644535e-03
       5.000000e-01    4.065198e-02    2.057251e-03
       5.100000e-01    3.850331e-02    2.453027e-03
       5.200000e-01    3.543363e-02    2.822712e-03
       5.300000e-01    3.144955e-02    3.157128e-03
       5.400000e-01    2.657680e-02    3.447259e-03
       5.500000e-01    2.086087e-02    3.684448e-03
       5.600000e-01    1.436730e-02    3.860589e-03
       5.700000e-01    7.181592e-03    3.968333e-03
       5.800000e-01    -5.913041e-04   4.001284e-03
       5.900000e-01    -8.827941e-03   3.954188e-03
       6.000000e-01    -1.738774e-02   3.823110e-03
       6.100000e-01    -2.611480e-02   3.605597e-03
       6.200000e-01    -3.484017e-02   3.300822e-03
       6.300000e-01    -4.338452e-02   2.909699e-03
       6.400000e-01    -5.156122e-02   2.434970e-03
       6.500000e-01    -5.917973e-02   1.881265e-03
       6.600000e-01    -6.604937e-02   1.255120e-03
       6.700000e-01    -7.198324e-02   5.649569e-04
       6.800000e-01    -7.680237e-02   -1.789711e-04
       6.900000e-01    -8.033986e-02   -9.646823e-04
       7.000000e-01    -8.244509e-02   -1.778607e-03
       7.100000e-01    -8.298774e-02   -2.605771e-03
       7.200000e-01    -8.186168e-02   -3.430018e-03
       7.300000e-01    -7.898853e-02   -4.234269e-03
       7.400000e-01    -7.432086e-02   -5.000816e-03
       7.500000e-01    -6.784496e-02   -5.711645e-03
       7.600000e-01    -5.958314e-02   -6.348786e-03
       7.700000e-01    -4.959542e-02   -6.894679e-03
       7.800000e-01    -3.798063e-02   -7.332559e-03
       7.900000e-01    -2.487687e-02   -7.646846e-03
       8.000000e-01    -1.046119e-02   -7.823537e-03
       8.100000e-01    5.051456e-03    -7.850585e-03
       8.200000e-01    2.141012e-02    -7.718278e-03
       8.300000e-01    3.833062e-02    -7.419574e-03
       8.400000e-01    5.549924e-02    -6.950425e-03
       8.500000e-01    7.257739e-02    -6.310041e-03
       8.600000e-01    8.920707e-02    -5.501119e-03
       8.700000e-01    1.050173e-01    -4.529997e-03
       8.800000e-01    1.196315e-01    -3.406753e-03
       8.900000e-01    1.326747e-01    -2.145222e-03
       9.000000e-01    1.437825e-01    -7.629364e-04
       9.100000e-01    1.526090e-01    7.190208e-04
       9.200000e-01    1.588353e-01    2.276242e-03
       9.300000e-01    1.621779e-01    3.881308e-03
       9.400000e-01    1.623962e-01    5.504179e-03
       9.500000e-01    1.592993e-01    7.112656e-03
       9.600000e-01    1.527531e-01    8.672918e-03
       9.700000e-01    1.426847e-01    1.015011e-02
       9.800000e-01    1.290879e-01    1.150897e-02
       9.900000e-01    1.120265e-01    1.271454e-02
       1.000000e+00    9.163694e-02    1.373286e-02
       1.010000e+00    6.813077e-02    1.453170e-02
       1.020000e+00    4.179524e-02    1.508133e-02
       1.030000e+00    1.299338e-02    1.535527e-02
       1.040000e+00    -1.783751e-02   1.533105e-02
       1.050000e+00    -5.018880e-02   1.499092e-02
       1.060000e+00    -8.348550e-02   1.432255e-02
       1.070000e+00    -1.170934e-01   1.331965e-02
       1.080000e+00    -1.503285e-01   1.198254e-02
       1.090000e+00    -1.824696e-01   1.031855e-02
       1.100000e+00    -2.127725e-01   8.342343e-03
       1.110000e+00    -2.404867e-01   6.076047e-03
       1.120000e+00    -2.648741e-01   3.549243e-03
       1.130000e+00    -2.852271e-01   7.987369e-04
       1.140000e+00    -3.008880e-01   -2.131839e-03
       1.150000e+00    -3.112656e-01   -5.192607e-03
       1.160000e+00    -3.158511e-01   -8.328190e-03
       1.170000e+00    -3.142304e-01   -1.147860e-02
       1.180000e+00    -3.060947e-01   -1.458022e-02
       1.190000e+00    -2.912475e-01   -1.756693e-02
       1.200000e+00    -2.696106e-01   -2.037123e-02
       1.210000e+00    -2.412282e-01   -2.292542e-02
       1.220000e+00    -2.062711e-01   -2.516292e-02
       1.230000e+00    -1.650406e-01   -2.701948e-02
       1.240000e+00    -1.179738e-01   -2.843455e-02
       1.250000e+00    -6.564866e-02   -2.935266e-02
       1.260000e+00    -8.790385e-03   -2.972485e-02
       1.270000e+00    5.172491e-02    -2.951018e-02
       1.280000e+00    1.148688e-01    -2.867721e-02
       1.290000e+00    1.794650e-01    -2.720554e-02
       1.300000e+00    2.442021e-01    -2.508721e-02
       1.310000e+00    3.076558e-01    -2.232792e-02
       1.320000e+00    3.683229e-01    -1.894803e-02
       1.330000e+00    4.246655e-01    -1.498308e-02
       1.340000e+00    4.751626e-01    -1.048394e-02
       1.350000e+00    5.183658e-01    -5.516303e-03
       1.360000e+00    5.529519e-01    -1.597142e-04
       1.370000e+00    5.777679e-01    5.493885e-03
       1.380000e+00    5.918634e-01    1.134204e-02
       1.390000e+00    5.945073e-01    1.727389e-02
       1.400000e+00    5.851913e-01    2.317239e-02
       1.410000e+00    5.636205e-01    2.891645e-02
       1.420000e+00    5.296980e-01    3.438304e-02
       1.430000e+00    4.835085e-01    3.944907e-02
       1.440000e+00    4.253058e-01    4.399314e-02
       1.450000e+00    3.555115e-01    4.789723e-02
       1.460000e+00    2.747259e-01    5.104842e-02
       1.470000e+00    1.837547e-01    5.334082e-02
       1.480000e+00    8.365076e-02    5.467785e-02
       1.490000e+00    -2.423406e-02   5.497493e-02
       1.500000e+00    -1.381940e-01   5.416279e-02
       1.510000e+00    -2.561251e-01   5.219119e-02
       1.520000e+00    -3.755095e-01   4.903302e-02
       1.530000e+00    -4.934455e-01   4.468825e-02
       1.540000e+00    -6.067399e-01   3.918732e-02
       1.550000e+00    -7.120641e-01   3.259330e-02
       1.560000e+00    -8.061604e-01   2.500218e-02
       1.570000e+00    -8.860643e-01   1.654105e-02
       1.580000e+00    -9.493014e-01   7.364225e-03
       1.590000e+00    -9.940179e-01   -2.352372e-03
       1.600000e+00    -1.019022e+00   -1.241757e-02
       1.610000e+00    -1.023740e+00   -2.263138e-02
       1.620000e+00    -1.008102e+00   -3.279059e-02
       1.630000e+00    -9.724051e-01   -4.269313e-02
       1.640000e+00    -9.171655e-01   -5.214098e-02
       1.650000e+00    -8.430038e-01   -6.094183e-02
       1.660000e+00    -7.505677e-01   -6.890969e-02
       1.670000e+00    -6.405062e-01   -7.586506e-02
       1.680000e+00    -5.134983e-01   -8.163508e-02
       1.690000e+00    -3.703422e-01   -8.605428e-02
       1.700000e+00    -2.121083e-01   -8.896653e-02
       1.710000e+00    -4.035356e-02   -9.022884e-02
       1.720000e+00    1.426172e-01    -8.971752e-02
       1.730000e+00    3.334854e-01    -8.733701e-02
       1.740000e+00    5.277265e-01    -8.303095e-02
       1.750000e+00    7.196021e-01    -7.679431e-02
       1.760000e+00    9.024443e-01    -6.868408e-02
       1.770000e+00    1.069265e+00    -5.882553e-02
       1.780000e+00    1.213589e+00    -4.741126e-02
       1.790000e+00    1.330281e+00    -3.469192e-02
       1.800000e+00    1.416088e+00    -2.096007e-02
       1.810000e+00    1.469754e+00    -6.530861e-03
       1.820000e+00    1.491717e+00    8.276496e-03
       1.830000e+00    1.483568e+00    2.315292e-02
       1.840000e+00    1.447475e+00    3.780814e-02
       1.850000e+00    1.385694e+00    5.197399e-02
       1.860000e+00    1.300245e+00    6.540368e-02
       1.870000e+00    1.192731e+00    7.786856e-02
       1.880000e+00    1.064286e+00    8.915365e-02
       1.890000e+00    9.156060e-01    9.905311e-02
       1.900000e+00    7.470667e-01    1.073665e-01
       1.910000e+00    5.589184e-01    1.138964e-01
       1.920000e+00    3.515877e-01    1.184489e-01
       1.930000e+00    1.261093e-01    1.208374e-01
       1.940000e+00    -1.153016e-01   1.208915e-01
       1.950000e+00    -3.685953e-01   1.184720e-01
       1.960000e+00    -6.273254e-01   1.134924e-01
       1.970000e+00    -8.824969e-01   1.059433e-01
       1.980000e+00    -1.123181e+00   9.591486e-02
       1.990000e+00    -1.338023e+00   8.360884e-02
       2.000000e+00    -1.517274e+00   6.933236e-02
       2.010000e+00    -1.654537e+00   5.347330e-02
       2.020000e+00    -1.747479e+00   3.646321e-02
       2.030000e+00    -1.797346e+00   1.873909e-02
       2.040000e+00    -1.807731e+00   7.137046e-04
       2.050000e+00    -1.783221e+00   -1.724105e-02
       2.060000e+00    -1.728359e+00   -3.479895e-02
       2.070000e+00    -1.647035e+00   -5.167592e-02
       2.080000e+00    -1.542229e+00   -6.762223e-02
       2.090000e+00    -1.415980e+00   -8.241328e-02
       2.100000e+00    -1.269471e+00   -9.584053e-02
       2.110000e+00    -1.103171e+00   -1.077037e-01
       2.120000e+00    -9.170172e-01   -1.178047e-01
       2.130000e+00    -7.106536e-01   -1.259430e-01
       2.140000e+00    -4.837670e-01   -1.319151e-01
       2.150000e+00    -2.365829e-01   -1.355169e-01
       2.160000e+00    2.943436e-02    -1.365526e-01
       2.170000e+00    3.106929e-01    -1.348520e-01
       2.180000e+00    6.005813e-01    -1.302956e-01
       2.190000e+00    8.890009e-01    -1.228477e-01
       2.200000e+00    1.162913e+00    -1.125881e-01
       2.210000e+00    1.408253e+00    -9.973230e-02
       2.220000e+00    1.612789e+00    -8.462709e-02
       2.230000e+00    1.768695e+00    -6.771967e-02
       2.240000e+00    1.873586e+00    -4.950827e-02
       2.250000e+00    1.929755e+00    -3.049157e-02
       2.260000e+00    1.942350e+00    -1.113104e-02
       2.270000e+00    1.917496e+00    8.168189e-03
       2.280000e+00    1.860981e+00    2.706057e-02
       2.290000e+00    1.777570e+00    4.525333e-02
       2.300000e+00    1.670801e+00    6.249518e-02
       2.310000e+00    1.543033e+00    7.856435e-02
       2.320000e+00    1.395598e+00    9.325751e-02
       2.330000e+00    1.228988e+00    1.063804e-01
       2.340000e+00    1.043056e+00    1.177407e-01
       2.350000e+00    8.372413e-01    1.271421e-01
       2.360000e+00    6.108658e-01    1.343827e-01
       2.370000e+00    3.635781e-01    1.392549e-01
       2.380000e+00    9.600333e-02    1.415528e-01
       2.390000e+00    -1.893635e-01   1.410860e-01
       2.400000e+00    -4.871260e-01   1.377036e-01
       2.410000e+00    -7.881778e-01   1.313270e-01
       2.420000e+00    -1.079752e+00   1.219874e-01
       2.430000e+00    -1.346937e+00   1.098539e-01
       2.440000e+00    -1.575578e+00   9.524137e-02
       2.450000e+00    -1.755467e+00   7.858614e-02
       2.460000e+00    -1.882200e+00   6.039781e-02
       2.470000e+00    -1.956944e+00   4.120209e-02
       2.480000e+00    -1.984641e+00   2.149417e-02
       2.490000e+00    -1.971835e+00   1.711787e-03
       2.500000e+00    -1.925000e+00   -1.777239e-02
       2.510000e+00    -1.849624e+00   -3.664551e-02
       2.520000e+00    -1.749874e+00   -5.464300e-02
       2.530000e+00    -1.628616e+00   -7.153545e-02
       2.540000e+00    -1.487569e+00   -8.711637e-02
       2.550000e+00    -1.327511e+00   -1.011918e-01
       2.560000e+00    -1.148479e+00   -1.135717e-01
       2.570000e+00    -9.499833e-01   -1.240640e-01
       2.580000e+00    -7.312638e-01   -1.324703e-01
       2.590000e+00    -4.916579e-01   -1.385849e-01
       2.600000e+00    -2.311485e-01   -1.421989e-01
       2.610000e+00    4.884032e-02    -1.431105e-01
       2.620000e+00    3.444258e-01    -1.411441e-01
       2.630000e+00    6.482549e-01    -1.361807e-01
       2.640000e+00    9.490364e-01    -1.281943e-01
       2.650000e+00    1.232329e+00    -1.172874e-01
       2.660000e+00    1.482936e+00    -1.037111e-01
       2.670000e+00    1.688257e+00    -8.785515e-02
       2.680000e+00    1.841019e+00    -7.020877e-02
       2.690000e+00    1.940025e+00    -5.130356e-02
       2.700000e+00    1.988898e+00    -3.165894e-02
       2.710000e+00    1.993866e+00    -1.174512e-02
       2.720000e+00    1.961742e+00    8.032923e-03
       2.730000e+00    1.898646e+00    2.733487e-02
       2.740000e+00    1.809434e+00    4.587527e-02
       2.750000e+00    1.697596e+00    6.341042e-02
       2.760000e+00    1.565372e+00    7.972526e-02
       2.770000e+00    1.413958e+00    9.462191e-02
       2.780000e+00    1.243704e+00    1.079102e-01
       2.790000e+00    1.054326e+00    1.194004e-01
       2.800000e+00    8.451350e-01    1.288977e-01
       2.810000e+00    6.153404e-01    1.362000e-01
       2.820000e+00    3.644985e-01    1.410992e-01
       2.830000e+00    9.318505e-02    1.433877e-01
       2.840000e+00    -1.960803e-01   1.428732e-01
       2.850000e+00    -4.977636e-01   1.394040e-01
       2.860000e+00    -8.024866e-01   1.329027e-01
       2.870000e+00    -1.097108e+00   1.234047e-01
       2.880000e+00    -1.366342e+00   1.110875e-01
       2.890000e+00    -1.595823e+00   9.627667e-02
       2.900000e+00    -1.775378e+00   7.942067e-02
       2.910000e+00    -1.900868e+00   6.103944e-02
       2.920000e+00    -1.973827e+00   4.166597e-02
       2.930000e+00    -1.999532e+00   2.179917e-02
       2.940000e+00    -1.984764e+00   1.877690e-03
       2.950000e+00    -1.936126e+00   -1.772676e-02
       2.960000e+00    -1.859153e+00   -3.670315e-02
       2.970000e+00    -1.758015e+00   -5.478900e-02
       2.980000e+00    -1.635551e+00   -7.175683e-02
       2.990000e+00    -1.493447e+00   -8.740182e-02
       3.000000e+00    -1.332442e+00   -1.015313e-01
       3.010000e+00    -1.152537e+00   -1.139562e-01
       3.020000e+00    -9.532081e-01   -1.244849e-01
       3.030000e+00    -7.336619e-01   -1.329192e-01
       3.040000e+00    -4.932068e-01   -1.390536e-01
       3.050000e+00    -2.318026e-01   -1.426786e-01
       3.060000e+00    4.913790e-02    -1.435920e-01
       3.070000e+00    3.457213e-01    -1.416177e-01
       3.080000e+00    6.505531e-01    -1.366363e-01
       3.090000e+00    9.522661e-01    -1.286222e-01
       3.100000e+00    1.236322e+00    -1.176792e-01
       3.110000e+00    1.487440e+00    -1.040604e-01
       3.120000e+00    1.692983e+00    -8.815833e-02
       3.130000e+00    1.845699e+00    -7.046492e-02
       3.140000e+00    1.944464e+00    -5.151411e-02
       3.150000e+00    1.992985e+00    -3.182686e-02
       3.160000e+00    1.997560e+00    -1.187414e-02
       3.170000e+00    1.965052e+00    7.938921e-03
       3.180000e+00    1.901603e+00    2.727220e-02
       3.190000e+00    1.812082e+00    4.584062e-02
       3.200000e+00    1.699977e+00    6.340092e-02
       3.210000e+00    1.567525e+00    7.973842e-02
       3.220000e+00    1.415914e+00    9.465562e-02
       3.230000e+00    1.245487e+00    1.079626e-01
       3.240000e+00    1.055953e+00    1.194698e-01
       3.250000e+00    8.466158e-01    1.289827e-01
       3.260000e+00    6.166747e-01    1.362991e-01
       3.270000e+00    3.656774e-01    1.412109e-01
       3.280000e+00    9.419001e-02    1.435102e-01
       3.290000e+00    -1.952767e-01   1.430048e-01
       3.300000e+00    -4.971942e-01   1.395424e-01
       3.310000e+00    -8.021825e-01   1.330455e-01
       3.320000e+00    -1.097088e+00   1.235492e-01
       3.330000e+00    -1.366603e+00   1.112307e-01
       3.340000e+00    -1.596335e+00   9.641605e-02
       3.350000e+00    -1.776091e+00   7.955392e-02
       3.360000e+00    -1.901725e+00   6.116484e-02
       3.370000e+00    -1.974775e+00   4.178234e-02
       3.380000e+00    -2.000531e+00   2.190581e-02
       3.390000e+00    -1.985786e+00   1.974218e-03
       3.400000e+00    -1.937157e+00   -1.764050e-02
       3.410000e+00    -1.860187e+00   -3.662722e-02
       3.420000e+00    -1.759051e+00   -5.472341e-02
       3.430000e+00    -1.636592e+00   -7.170162e-02
       3.440000e+00    -1.494497e+00   -8.735706e-02
       3.450000e+00    -1.333509e+00   -1.014971e-01
       3.460000e+00    -1.153627e+00   -1.139328e-01
       3.470000e+00    -9.543259e-01   -1.244725e-01
       3.480000e+00    -7.348122e-01   -1.329182e-01
       3.490000e+00    -4.943901e-01   -1.390642e-01
       3.500000e+00    -2.330135e-01   -1.427013e-01
       3.510000e+00    4.791367e-02    -1.436268e-01
       3.520000e+00    3.445106e-01    -1.416646e-01
       3.530000e+00    6.493964e-01    -1.366951e-01
       3.540000e+00    9.512155e-01    -1.286920e-01
       3.550000e+00    1.235432e+00    -1.177588e-01
       3.560000e+00    1.486757e+00    -1.041479e-01
       3.570000e+00    1.692530e+00    -8.825142e-02
       3.580000e+00    1.845476e+00    -7.056139e-02
       3.590000e+00    1.944452e+00    -5.161175e-02
       3.600000e+00    1.993152e+00    -3.192373e-02
       3.610000e+00    1.997875e+00    -1.196860e-02
       3.620000e+00    1.965485e+00    7.848205e-03
       3.630000e+00    1.902135e+00    2.718631e-02
       3.640000e+00    1.812696e+00    4.576046e-02
       3.650000e+00    1.700664e+00    6.332726e-02
       3.660000e+00    1.568281e+00    7.967199e-02
       3.670000e+00    1.416738e+00    9.459708e-02
       3.680000e+00    1.246380e+00    1.079127e-01
       3.690000e+00    1.056920e+00    1.194292e-01
       3.700000e+00    8.476591e-01    1.289521e-01
       3.710000e+00    6.177980e-01    1.362794e-01
       3.720000e+00    3.668806e-01    1.412027e-01
       3.730000e+00    9.546592e-02    1.435145e-01
       3.740000e+00    -1.939464e-01   1.430221e-01
       3.750000e+00    -4.958433e-01   1.395731e-01
       3.760000e+00    -8.008621e-01   1.330896e-01
       3.770000e+00    -1.095862e+00   1.236060e-01
       3.780000e+00    -1.365538e+00   1.112990e-01
       3.790000e+00    -1.595484e+00   9.649387e-02
       3.800000e+00    -1.775482e+00   7.963905e-02
       3.810000e+00    -1.901358e+00   6.125485e-02
       3.820000e+00    -1.974631e+00   4.187490e-02
       3.830000e+00    -2.000580e+00   2.199885e-02
       3.840000e+00    -1.985996e+00   2.065968e-03
       3.850000e+00    -1.937500e+00   -1.755151e-02
       3.860000e+00    -1.860642e+00   -3.654222e-02
       3.870000e+00    -1.759603e+00   -5.464344e-02
       3.880000e+00    -1.637231e+00   -7.162761e-02
       3.890000e+00    -1.495220e+00   -8.728986e-02
       3.900000e+00    -1.334313e+00   -1.014375e-01
       3.910000e+00    -1.154514e+00   -1.138817e-01
       3.920000e+00    -9.553006e-01   -1.244307e-01
       3.930000e+00    -7.358777e-01   -1.328866e-01
       3.940000e+00    -4.955485e-01   -1.390438e-01
       3.950000e+00    -2.342622e-01   -1.426928e-01
       3.960000e+00    4.658621e-02    -1.436312e-01
       3.970000e+00    3.431296e-01    -1.416826e-01
       3.980000e+00    6.480050e-01    -1.367269e-01
       3.990000e+00    9.498738e-01    -1.287375e-01
       4.000000e+00    1.234211e+00    -1.178171e-01
       4.010000e+00    1.348035e+00    -1.049059e-01
       4.020000e+00    1.434001e+00    -9.099571e-02
       4.030000e+00    1.763964e+00    -7.500588e-02
       4.040000e+00    2.271569e+00    -5.482822e-02
       4.050000e+00    2.828784e+00    -2.932645e-02
       4.060000e+00    3.295038e+00    1.292655e-03
       4.070000e+00    3.589773e+00    3.571671e-02
       4.080000e+00    3.706446e+00    7.219780e-02
       4.090000e+00    3.669744e+00    1.090788e-01
       4.100000e+00    3.500182e+00    1.449284e-01
       4.110000e+00    3.204318e+00    1.784509e-01
       4.120000e+00    2.774834e+00    2.083466e-01
       4.130000e+00    2.189913e+00    2.331704e-01
       4.140000e+00    1.410468e+00    2.511723e-01
       4.150000e+00    3.846573e-01    2.601479e-01
       4.160000e+00    -9.007856e-01   2.575673e-01
       4.170000e+00    -2.274652e+00   2.416901e-01
       4.180000e+00    -3.356009e+00   2.135368e-01
       4.190000e+00    -3.915062e+00   1.771814e-01
       4.200000e+00    -4.055733e+00   1.373274e-01
       4.210000e+00    -3.953885e+00   9.727935e-02
       4.220000e+00    -3.701269e+00   5.900358e-02
       4.230000e+00    -3.330308e+00   2.384569e-02
       4.240000e+00    -2.845787e+00   -7.034781e-03
       4.250000e+00    -2.237786e+00   -3.245264e-02
       4.260000e+00    -1.486267e+00   -5.107291e-02
       4.270000e+00    -5.692806e-01   -6.135064e-02
       4.280000e+00    5.045736e-01    -6.167418e-02
       4.290000e+00    1.624227e+00    -5.103018e-02
       4.300000e+00    2.552139e+00    -3.014835e-02
       4.310000e+00    3.086544e+00    -1.954931e-03
       4.320000e+00    3.219008e+00    2.957283e-02
       4.330000e+00    3.053501e+00    6.093538e-02
       4.340000e+00    2.672575e+00    8.956576e-02
       4.350000e+00    2.107294e+00    1.134651e-01
       4.360000e+00    1.350842e+00    1.307558e-01
       4.370000e+00    3.790633e-01    1.394053e-01
       4.380000e+00    -7.981544e-01   1.373099e-01
       4.390000e+00    -2.029018e+00   1.231740e-01
       4.400000e+00    -3.006532e+00   9.799624e-02
       4.410000e+00    -3.524682e+00   6.534017e-02
       4.420000e+00    -3.636264e+00   2.953545e-02
       4.430000e+00    -3.482441e+00   -6.058080e-03
       4.440000e+00    -3.149646e+00   -3.921851e-02
       4.450000e+00    -2.668403e+00   -6.830876e-02
       4.460000e+00    -2.036189e+00   -9.183172e-02
       4.470000e+00    -1.230479e+00   -1.081651e-01
       4.480000e+00    -2.255167e-01   -1.154450e-01
       4.490000e+00    9.535994e-01    -1.118046e-01
       4.500000e+00    2.132755e+00    -9.637285e-02
       4.510000e+00    3.017959e+00    -7.061928e-02
       4.520000e+00    3.448993e+00    -3.828452e-02
       4.530000e+00    3.497503e+00    -3.552032e-03
       4.540000e+00    3.292573e+00    3.039835e-02
       4.550000e+00    2.907995e+00    6.140119e-02
       4.560000e+00    2.366183e+00    8.777209e-02
       4.570000e+00    1.657937e+00    1.078927e-01
       4.580000e+00    7.569600e-01    1.199672e-01
       4.590000e+00    -3.484448e-01   1.220097e-01
       4.600000e+00    -1.570178e+00   1.124166e-01
       4.610000e+00    -2.648944e+00   9.132103e-02
       4.620000e+00    -3.319205e+00   6.148028e-02
       4.630000e+00    -3.547413e+00   2.714719e-02
       4.640000e+00    -3.461646e+00   -7.898104e-03
       4.650000e+00    -3.168924e+00   -4.105095e-02
       4.660000e+00    -2.715322e+00   -7.047218e-02
       4.670000e+00    -2.106377e+00   -9.458068e-02
       4.680000e+00    -1.323201e+00   -1.117286e-01
       4.690000e+00    -3.390657e-01   -1.200399e-01
       4.700000e+00    8.311525e-01    -1.175795e-01
       4.710000e+00    2.031066e+00    -1.032684e-01
       4.720000e+00    2.965559e+00    -7.828525e-02
       4.730000e+00    3.447580e+00    -4.621955e-02
       4.740000e+00    3.532370e+00    -1.131980e-02
       4.750000e+00    3.353211e+00    2.310810e-02
       4.760000e+00    2.991133e+00    5.482982e-02
       4.770000e+00    2.473286e+00    8.215192e-02
       4.780000e+00    1.793698e+00    1.034868e-01
       4.790000e+00    9.273228e-01    1.170919e-01
       4.800000e+00    -1.442914e-01   1.210071e-01
       4.810000e+00    -1.358326e+00   1.134940e-01
       4.820000e+00    -2.482322e+00   9.429078e-02
       4.830000e+00    -3.231321e+00   6.572257e-02
       4.840000e+00    -3.527202e+00   3.192996e-02
       4.850000e+00    -3.485136e+00   -3.131732e-03
       4.860000e+00    -3.221974e+00   -3.666728e-02
       4.870000e+00    -2.792955e+00   -6.674193e-02
       4.880000e+00    -2.209052e+00   -9.175197e-02
       4.890000e+00    -1.454516e+00   -1.100698e-01
       4.900000e+00    -5.019904e-01   -1.198523e-01
       4.910000e+00    6.456663e-01    -1.191340e-01
       4.920000e+00    1.859204e+00    -1.066096e-01
       4.930000e+00    2.852672e+00    -8.305023e-02
       4.940000e+00    3.405278e+00    -5.176049e-02
       4.950000e+00    3.541631e+00    -1.702594e-02
       4.960000e+00    3.396051e+00    1.766247e-02
       4.970000e+00    3.059423e+00    4.993984e-02
       4.980000e+00    2.565621e+00    7.806506e-02
       4.990000e+00    1.912765e+00    1.004570e-01
       5.000000e+00    1.077766e+00    1.154096e-01
       5.010000e+00    3.784220e-02    1.209877e-01
       5.020000e+00    -1.164393e+00   1.153549e-01
       5.030000e+00    -2.323473e+00   9.791560e-02
       5.040000e+00    -3.143898e+00   7.057874e-02
       5.050000e+00    -3.506084e+00   3.732883e-02
       5.060000e+00    -3.508033e+00   2.258249e-03
       5.070000e+00    -3.274540e+00   -3.165462e-02
       5.080000e+00    -2.869958e+00   -6.237711e-02
       5.090000e+00    -2.310816e+00   -8.828097e-02
       5.100000e+00    -1.584724e+00   -1.077587e-01
       5.110000e+00    -6.645659e-01   -1.190051e-01
       5.120000e+00    4.566032e-01    -1.200449e-01
       5.130000e+00    1.676110e+00    -1.093814e-01
       5.140000e+00    2.723861e+00    -8.738152e-02
       5.150000e+00    3.349681e+00    -5.701381e-02
       5.160000e+00    3.542344e+00    -2.255369e-02
       5.170000e+00    3.433122e+00    1.232364e-02
       5.180000e+00    3.122960e+00    4.510405e-02
       5.190000e+00    2.653175e+00    7.398473e-02
       5.200000e+00    2.026363e+00    9.738242e-02
       5.210000e+00    1.221851e+00    1.136235e-01
       5.220000e+00    2.141115e-01    1.208033e-01
       5.230000e+00    -9.713906e-01   1.170169e-01
       5.240000e+00    -2.157449e+00   1.013727e-01
       5.250000e+00    -3.045837e+00   7.535628e-02
       5.260000e+00    -3.476830e+00   4.274295e-02
       5.270000e+00    -3.525735e+00   7.730120e-03
       5.280000e+00    -3.323320e+00   -2.651516e-02
       5.290000e+00    -2.943500e+00   -5.784926e-02
       5.300000e+00    -2.408798e+00   -8.461075e-02
       5.310000e+00    -1.710472e+00   -1.052071e-01
       5.320000e+00    -8.223975e-01   -1.178714e-01
       5.330000e+00    2.699002e-01    -1.206339e-01
       5.340000e+00    1.488282e+00    -1.118430e-01
       5.350000e+00    2.583690e+00    -9.148316e-02
       5.360000e+00    3.282898e+00    -6.215022e-02
       5.370000e+00    3.535605e+00    -2.805771e-02
     };
 \end{axis}
\end{tikzpicture}
\end{document} 

This is the code I was working with to plot the table, but I have no idea how to animate the plot (with controls). Is there an elegant way to do this?

Im sorry but I couldnt get my simulation to be any shorter than this without getting ugly plots, which is why the table is pretty long

Thank you for all the answers

1 Answer 1

5

Put the tikzpicture into a \multiframe loop inside the animateinline environment.

The coordinates of the 3D curve need to be filtered as a function of an integer idx that is incremented on each loop execution. Coordinates with an index higher than the current loop counter value are discarded. This lets the 3D curve grow from frame to frame.


Interactive SVG version for Chromium-based browsers (Chromium, Chrome, Opera) as Firefox is painfully slow.

enter image description here

\documentclass{standalone}

\usepackage{animate}
\usepackage{tikz,pgfplots,pgfplotstable}
\pgfplotsset{compat=newest}

\begin{filecontents*}{tabledata.dat}
  t   u_C   i_L
  0.000000e+00    1.025483e-02    5.127415e-05
  1.000000e-02    1.067231e-02    1.559099e-04
  2.000000e-02    1.089647e-02    2.637538e-04
  3.000000e-02    1.091086e-02    3.727904e-04
  4.000000e-02    1.070236e-02    4.808566e-04
  5.000000e-02    1.026160e-02    5.856764e-04
  6.000000e-02    9.583387e-03    6.849013e-04
  7.000000e-02    8.667108e-03    7.761538e-04
  8.000000e-02    7.516976e-03    8.570742e-04
  9.000000e-02    6.142264e-03    9.253704e-04
  1.000000e-01    4.557415e-03    9.788688e-04
  1.100000e-01    2.782068e-03    1.015566e-03
  1.200000e-01    8.409701e-04    1.033681e-03
  1.300000e-01    -1.236215e-03   1.031705e-03
  1.400000e-01    -3.415216e-03   1.008448e-03
  1.500000e-01    -5.657576e-03   9.630841e-04
  1.600000e-01    -7.921179e-03   8.951903e-04
  1.700000e-01    -1.016090e-02   8.047799e-04
  1.800000e-01    -1.232933e-02   6.923288e-04
  1.900000e-01    -1.437762e-02   5.587940e-04
  2.000000e-01    -1.625642e-02   4.056238e-04
  2.100000e-01    -1.791680e-02   2.347577e-04
  2.200000e-01    -1.931133e-02   4.861710e-05
  2.300000e-01    -2.039514e-02   -1.499153e-04
  2.400000e-01    -2.112699e-02   -3.575259e-04
  2.500000e-01    -2.147032e-02   -5.705125e-04
  2.600000e-01    -2.139432e-02   -7.848357e-04
  2.700000e-01    -2.087488e-02   -9.961817e-04
  2.800000e-01    -1.989552e-02   -1.200034e-03
  2.900000e-01    -1.844818e-02   -1.391752e-03
  3.000000e-01    -1.653390e-02   -1.566663e-03
  3.100000e-01    -1.416335e-02   -1.720149e-03
  3.200000e-01    -1.135722e-02   -1.847752e-03
  3.300000e-01    -8.146375e-03   -1.945270e-03
  3.400000e-01    -4.571887e-03   -2.008861e-03
  3.500000e-01    -6.847962e-04   -2.035145e-03
  3.600000e-01    3.454317e-03    -2.021297e-03
  3.700000e-01    7.775987e-03    -1.965145e-03
  3.800000e-01    1.220274e-02    -1.865252e-03
  3.900000e-01    1.665020e-02    -1.720987e-03
  4.000000e-01    2.102837e-02    -1.532594e-03
  4.100000e-01    2.524319e-02    -1.301236e-03
  4.200000e-01    2.919817e-02    -1.029030e-03
  4.300000e-01    3.279623e-02    -7.190575e-04
  4.400000e-01    3.594173e-02    -3.753677e-04
  4.500000e-01    3.854242e-02    -2.947034e-06
  4.600000e-01    4.051163e-02    3.923232e-04
  4.700000e-01    4.177037e-02    8.037332e-04
  4.800000e-01    4.224938e-02    1.223832e-03
  4.900000e-01    4.189119e-02    1.644535e-03
  5.000000e-01    4.065198e-02    2.057251e-03
  5.100000e-01    3.850331e-02    2.453027e-03
  5.200000e-01    3.543363e-02    2.822712e-03
  5.300000e-01    3.144955e-02    3.157128e-03
  5.400000e-01    2.657680e-02    3.447259e-03
  5.500000e-01    2.086087e-02    3.684448e-03
  5.600000e-01    1.436730e-02    3.860589e-03
  5.700000e-01    7.181592e-03    3.968333e-03
  5.800000e-01    -5.913041e-04   4.001284e-03
  5.900000e-01    -8.827941e-03   3.954188e-03
  6.000000e-01    -1.738774e-02   3.823110e-03
  6.100000e-01    -2.611480e-02   3.605597e-03
  6.200000e-01    -3.484017e-02   3.300822e-03
  6.300000e-01    -4.338452e-02   2.909699e-03
  6.400000e-01    -5.156122e-02   2.434970e-03
  6.500000e-01    -5.917973e-02   1.881265e-03
  6.600000e-01    -6.604937e-02   1.255120e-03
  6.700000e-01    -7.198324e-02   5.649569e-04
  6.800000e-01    -7.680237e-02   -1.789711e-04
  6.900000e-01    -8.033986e-02   -9.646823e-04
  7.000000e-01    -8.244509e-02   -1.778607e-03
  7.100000e-01    -8.298774e-02   -2.605771e-03
  7.200000e-01    -8.186168e-02   -3.430018e-03
  7.300000e-01    -7.898853e-02   -4.234269e-03
  7.400000e-01    -7.432086e-02   -5.000816e-03
  7.500000e-01    -6.784496e-02   -5.711645e-03
  7.600000e-01    -5.958314e-02   -6.348786e-03
  7.700000e-01    -4.959542e-02   -6.894679e-03
  7.800000e-01    -3.798063e-02   -7.332559e-03
  7.900000e-01    -2.487687e-02   -7.646846e-03
  8.000000e-01    -1.046119e-02   -7.823537e-03
  8.100000e-01    5.051456e-03    -7.850585e-03
  8.200000e-01    2.141012e-02    -7.718278e-03
  8.300000e-01    3.833062e-02    -7.419574e-03
  8.400000e-01    5.549924e-02    -6.950425e-03
  8.500000e-01    7.257739e-02    -6.310041e-03
  8.600000e-01    8.920707e-02    -5.501119e-03
  8.700000e-01    1.050173e-01    -4.529997e-03
  8.800000e-01    1.196315e-01    -3.406753e-03
  8.900000e-01    1.326747e-01    -2.145222e-03
  9.000000e-01    1.437825e-01    -7.629364e-04
  9.100000e-01    1.526090e-01    7.190208e-04
  9.200000e-01    1.588353e-01    2.276242e-03
  9.300000e-01    1.621779e-01    3.881308e-03
  9.400000e-01    1.623962e-01    5.504179e-03
  9.500000e-01    1.592993e-01    7.112656e-03
  9.600000e-01    1.527531e-01    8.672918e-03
  9.700000e-01    1.426847e-01    1.015011e-02
  9.800000e-01    1.290879e-01    1.150897e-02
  9.900000e-01    1.120265e-01    1.271454e-02
  1.000000e+00    9.163694e-02    1.373286e-02
  1.010000e+00    6.813077e-02    1.453170e-02
  1.020000e+00    4.179524e-02    1.508133e-02
  1.030000e+00    1.299338e-02    1.535527e-02
  1.040000e+00    -1.783751e-02   1.533105e-02
  1.050000e+00    -5.018880e-02   1.499092e-02
  1.060000e+00    -8.348550e-02   1.432255e-02
  1.070000e+00    -1.170934e-01   1.331965e-02
  1.080000e+00    -1.503285e-01   1.198254e-02
  1.090000e+00    -1.824696e-01   1.031855e-02
  1.100000e+00    -2.127725e-01   8.342343e-03
  1.110000e+00    -2.404867e-01   6.076047e-03
  1.120000e+00    -2.648741e-01   3.549243e-03
  1.130000e+00    -2.852271e-01   7.987369e-04
  1.140000e+00    -3.008880e-01   -2.131839e-03
  1.150000e+00    -3.112656e-01   -5.192607e-03
  1.160000e+00    -3.158511e-01   -8.328190e-03
  1.170000e+00    -3.142304e-01   -1.147860e-02
  1.180000e+00    -3.060947e-01   -1.458022e-02
  1.190000e+00    -2.912475e-01   -1.756693e-02
  1.200000e+00    -2.696106e-01   -2.037123e-02
  1.210000e+00    -2.412282e-01   -2.292542e-02
  1.220000e+00    -2.062711e-01   -2.516292e-02
  1.230000e+00    -1.650406e-01   -2.701948e-02
  1.240000e+00    -1.179738e-01   -2.843455e-02
  1.250000e+00    -6.564866e-02   -2.935266e-02
  1.260000e+00    -8.790385e-03   -2.972485e-02
  1.270000e+00    5.172491e-02    -2.951018e-02
  1.280000e+00    1.148688e-01    -2.867721e-02
  1.290000e+00    1.794650e-01    -2.720554e-02
  1.300000e+00    2.442021e-01    -2.508721e-02
  1.310000e+00    3.076558e-01    -2.232792e-02
  1.320000e+00    3.683229e-01    -1.894803e-02
  1.330000e+00    4.246655e-01    -1.498308e-02
  1.340000e+00    4.751626e-01    -1.048394e-02
  1.350000e+00    5.183658e-01    -5.516303e-03
  1.360000e+00    5.529519e-01    -1.597142e-04
  1.370000e+00    5.777679e-01    5.493885e-03
  1.380000e+00    5.918634e-01    1.134204e-02
  1.390000e+00    5.945073e-01    1.727389e-02
  1.400000e+00    5.851913e-01    2.317239e-02
  1.410000e+00    5.636205e-01    2.891645e-02
  1.420000e+00    5.296980e-01    3.438304e-02
  1.430000e+00    4.835085e-01    3.944907e-02
  1.440000e+00    4.253058e-01    4.399314e-02
  1.450000e+00    3.555115e-01    4.789723e-02
  1.460000e+00    2.747259e-01    5.104842e-02
  1.470000e+00    1.837547e-01    5.334082e-02
  1.480000e+00    8.365076e-02    5.467785e-02
  1.490000e+00    -2.423406e-02   5.497493e-02
  1.500000e+00    -1.381940e-01   5.416279e-02
  1.510000e+00    -2.561251e-01   5.219119e-02
  1.520000e+00    -3.755095e-01   4.903302e-02
  1.530000e+00    -4.934455e-01   4.468825e-02
  1.540000e+00    -6.067399e-01   3.918732e-02
  1.550000e+00    -7.120641e-01   3.259330e-02
  1.560000e+00    -8.061604e-01   2.500218e-02
  1.570000e+00    -8.860643e-01   1.654105e-02
  1.580000e+00    -9.493014e-01   7.364225e-03
  1.590000e+00    -9.940179e-01   -2.352372e-03
  1.600000e+00    -1.019022e+00   -1.241757e-02
  1.610000e+00    -1.023740e+00   -2.263138e-02
  1.620000e+00    -1.008102e+00   -3.279059e-02
  1.630000e+00    -9.724051e-01   -4.269313e-02
  1.640000e+00    -9.171655e-01   -5.214098e-02
  1.650000e+00    -8.430038e-01   -6.094183e-02
  1.660000e+00    -7.505677e-01   -6.890969e-02
  1.670000e+00    -6.405062e-01   -7.586506e-02
  1.680000e+00    -5.134983e-01   -8.163508e-02
  1.690000e+00    -3.703422e-01   -8.605428e-02
  1.700000e+00    -2.121083e-01   -8.896653e-02
  1.710000e+00    -4.035356e-02   -9.022884e-02
  1.720000e+00    1.426172e-01    -8.971752e-02
  1.730000e+00    3.334854e-01    -8.733701e-02
  1.740000e+00    5.277265e-01    -8.303095e-02
  1.750000e+00    7.196021e-01    -7.679431e-02
  1.760000e+00    9.024443e-01    -6.868408e-02
  1.770000e+00    1.069265e+00    -5.882553e-02
  1.780000e+00    1.213589e+00    -4.741126e-02
  1.790000e+00    1.330281e+00    -3.469192e-02
  1.800000e+00    1.416088e+00    -2.096007e-02
  1.810000e+00    1.469754e+00    -6.530861e-03
  1.820000e+00    1.491717e+00    8.276496e-03
  1.830000e+00    1.483568e+00    2.315292e-02
  1.840000e+00    1.447475e+00    3.780814e-02
  1.850000e+00    1.385694e+00    5.197399e-02
  1.860000e+00    1.300245e+00    6.540368e-02
  1.870000e+00    1.192731e+00    7.786856e-02
  1.880000e+00    1.064286e+00    8.915365e-02
  1.890000e+00    9.156060e-01    9.905311e-02
  1.900000e+00    7.470667e-01    1.073665e-01
  1.910000e+00    5.589184e-01    1.138964e-01
  1.920000e+00    3.515877e-01    1.184489e-01
  1.930000e+00    1.261093e-01    1.208374e-01
  1.940000e+00    -1.153016e-01   1.208915e-01
  1.950000e+00    -3.685953e-01   1.184720e-01
  1.960000e+00    -6.273254e-01   1.134924e-01
  1.970000e+00    -8.824969e-01   1.059433e-01
  1.980000e+00    -1.123181e+00   9.591486e-02
  1.990000e+00    -1.338023e+00   8.360884e-02
  2.000000e+00    -1.517274e+00   6.933236e-02
  2.010000e+00    -1.654537e+00   5.347330e-02
  2.020000e+00    -1.747479e+00   3.646321e-02
  2.030000e+00    -1.797346e+00   1.873909e-02
  2.040000e+00    -1.807731e+00   7.137046e-04
  2.050000e+00    -1.783221e+00   -1.724105e-02
  2.060000e+00    -1.728359e+00   -3.479895e-02
  2.070000e+00    -1.647035e+00   -5.167592e-02
  2.080000e+00    -1.542229e+00   -6.762223e-02
  2.090000e+00    -1.415980e+00   -8.241328e-02
  2.100000e+00    -1.269471e+00   -9.584053e-02
  2.110000e+00    -1.103171e+00   -1.077037e-01
  2.120000e+00    -9.170172e-01   -1.178047e-01
  2.130000e+00    -7.106536e-01   -1.259430e-01
  2.140000e+00    -4.837670e-01   -1.319151e-01
  2.150000e+00    -2.365829e-01   -1.355169e-01
  2.160000e+00    2.943436e-02    -1.365526e-01
  2.170000e+00    3.106929e-01    -1.348520e-01
  2.180000e+00    6.005813e-01    -1.302956e-01
  2.190000e+00    8.890009e-01    -1.228477e-01
  2.200000e+00    1.162913e+00    -1.125881e-01
  2.210000e+00    1.408253e+00    -9.973230e-02
  2.220000e+00    1.612789e+00    -8.462709e-02
  2.230000e+00    1.768695e+00    -6.771967e-02
  2.240000e+00    1.873586e+00    -4.950827e-02
  2.250000e+00    1.929755e+00    -3.049157e-02
  2.260000e+00    1.942350e+00    -1.113104e-02
  2.270000e+00    1.917496e+00    8.168189e-03
  2.280000e+00    1.860981e+00    2.706057e-02
  2.290000e+00    1.777570e+00    4.525333e-02
  2.300000e+00    1.670801e+00    6.249518e-02
  2.310000e+00    1.543033e+00    7.856435e-02
  2.320000e+00    1.395598e+00    9.325751e-02
  2.330000e+00    1.228988e+00    1.063804e-01
  2.340000e+00    1.043056e+00    1.177407e-01
  2.350000e+00    8.372413e-01    1.271421e-01
  2.360000e+00    6.108658e-01    1.343827e-01
  2.370000e+00    3.635781e-01    1.392549e-01
  2.380000e+00    9.600333e-02    1.415528e-01
  2.390000e+00    -1.893635e-01   1.410860e-01
  2.400000e+00    -4.871260e-01   1.377036e-01
  2.410000e+00    -7.881778e-01   1.313270e-01
  2.420000e+00    -1.079752e+00   1.219874e-01
  2.430000e+00    -1.346937e+00   1.098539e-01
  2.440000e+00    -1.575578e+00   9.524137e-02
  2.450000e+00    -1.755467e+00   7.858614e-02
  2.460000e+00    -1.882200e+00   6.039781e-02
  2.470000e+00    -1.956944e+00   4.120209e-02
  2.480000e+00    -1.984641e+00   2.149417e-02
  2.490000e+00    -1.971835e+00   1.711787e-03
  2.500000e+00    -1.925000e+00   -1.777239e-02
  2.510000e+00    -1.849624e+00   -3.664551e-02
  2.520000e+00    -1.749874e+00   -5.464300e-02
  2.530000e+00    -1.628616e+00   -7.153545e-02
  2.540000e+00    -1.487569e+00   -8.711637e-02
  2.550000e+00    -1.327511e+00   -1.011918e-01
  2.560000e+00    -1.148479e+00   -1.135717e-01
  2.570000e+00    -9.499833e-01   -1.240640e-01
  2.580000e+00    -7.312638e-01   -1.324703e-01
  2.590000e+00    -4.916579e-01   -1.385849e-01
  2.600000e+00    -2.311485e-01   -1.421989e-01
  2.610000e+00    4.884032e-02    -1.431105e-01
  2.620000e+00    3.444258e-01    -1.411441e-01
  2.630000e+00    6.482549e-01    -1.361807e-01
  2.640000e+00    9.490364e-01    -1.281943e-01
  2.650000e+00    1.232329e+00    -1.172874e-01
  2.660000e+00    1.482936e+00    -1.037111e-01
  2.670000e+00    1.688257e+00    -8.785515e-02
  2.680000e+00    1.841019e+00    -7.020877e-02
  2.690000e+00    1.940025e+00    -5.130356e-02
  2.700000e+00    1.988898e+00    -3.165894e-02
  2.710000e+00    1.993866e+00    -1.174512e-02
  2.720000e+00    1.961742e+00    8.032923e-03
  2.730000e+00    1.898646e+00    2.733487e-02
  2.740000e+00    1.809434e+00    4.587527e-02
  2.750000e+00    1.697596e+00    6.341042e-02
  2.760000e+00    1.565372e+00    7.972526e-02
  2.770000e+00    1.413958e+00    9.462191e-02
  2.780000e+00    1.243704e+00    1.079102e-01
  2.790000e+00    1.054326e+00    1.194004e-01
  2.800000e+00    8.451350e-01    1.288977e-01
  2.810000e+00    6.153404e-01    1.362000e-01
  2.820000e+00    3.644985e-01    1.410992e-01
  2.830000e+00    9.318505e-02    1.433877e-01
  2.840000e+00    -1.960803e-01   1.428732e-01
  2.850000e+00    -4.977636e-01   1.394040e-01
  2.860000e+00    -8.024866e-01   1.329027e-01
  2.870000e+00    -1.097108e+00   1.234047e-01
  2.880000e+00    -1.366342e+00   1.110875e-01
  2.890000e+00    -1.595823e+00   9.627667e-02
  2.900000e+00    -1.775378e+00   7.942067e-02
  2.910000e+00    -1.900868e+00   6.103944e-02
  2.920000e+00    -1.973827e+00   4.166597e-02
  2.930000e+00    -1.999532e+00   2.179917e-02
  2.940000e+00    -1.984764e+00   1.877690e-03
  2.950000e+00    -1.936126e+00   -1.772676e-02
  2.960000e+00    -1.859153e+00   -3.670315e-02
  2.970000e+00    -1.758015e+00   -5.478900e-02
  2.980000e+00    -1.635551e+00   -7.175683e-02
  2.990000e+00    -1.493447e+00   -8.740182e-02
  3.000000e+00    -1.332442e+00   -1.015313e-01
  3.010000e+00    -1.152537e+00   -1.139562e-01
  3.020000e+00    -9.532081e-01   -1.244849e-01
  3.030000e+00    -7.336619e-01   -1.329192e-01
  3.040000e+00    -4.932068e-01   -1.390536e-01
  3.050000e+00    -2.318026e-01   -1.426786e-01
  3.060000e+00    4.913790e-02    -1.435920e-01
  3.070000e+00    3.457213e-01    -1.416177e-01
  3.080000e+00    6.505531e-01    -1.366363e-01
  3.090000e+00    9.522661e-01    -1.286222e-01
  3.100000e+00    1.236322e+00    -1.176792e-01
  3.110000e+00    1.487440e+00    -1.040604e-01
  3.120000e+00    1.692983e+00    -8.815833e-02
  3.130000e+00    1.845699e+00    -7.046492e-02
  3.140000e+00    1.944464e+00    -5.151411e-02
  3.150000e+00    1.992985e+00    -3.182686e-02
  3.160000e+00    1.997560e+00    -1.187414e-02
  3.170000e+00    1.965052e+00    7.938921e-03
  3.180000e+00    1.901603e+00    2.727220e-02
  3.190000e+00    1.812082e+00    4.584062e-02
  3.200000e+00    1.699977e+00    6.340092e-02
  3.210000e+00    1.567525e+00    7.973842e-02
  3.220000e+00    1.415914e+00    9.465562e-02
  3.230000e+00    1.245487e+00    1.079626e-01
  3.240000e+00    1.055953e+00    1.194698e-01
  3.250000e+00    8.466158e-01    1.289827e-01
  3.260000e+00    6.166747e-01    1.362991e-01
  3.270000e+00    3.656774e-01    1.412109e-01
  3.280000e+00    9.419001e-02    1.435102e-01
  3.290000e+00    -1.952767e-01   1.430048e-01
  3.300000e+00    -4.971942e-01   1.395424e-01
  3.310000e+00    -8.021825e-01   1.330455e-01
  3.320000e+00    -1.097088e+00   1.235492e-01
  3.330000e+00    -1.366603e+00   1.112307e-01
  3.340000e+00    -1.596335e+00   9.641605e-02
  3.350000e+00    -1.776091e+00   7.955392e-02
  3.360000e+00    -1.901725e+00   6.116484e-02
  3.370000e+00    -1.974775e+00   4.178234e-02
  3.380000e+00    -2.000531e+00   2.190581e-02
  3.390000e+00    -1.985786e+00   1.974218e-03
  3.400000e+00    -1.937157e+00   -1.764050e-02
  3.410000e+00    -1.860187e+00   -3.662722e-02
  3.420000e+00    -1.759051e+00   -5.472341e-02
  3.430000e+00    -1.636592e+00   -7.170162e-02
  3.440000e+00    -1.494497e+00   -8.735706e-02
  3.450000e+00    -1.333509e+00   -1.014971e-01
  3.460000e+00    -1.153627e+00   -1.139328e-01
  3.470000e+00    -9.543259e-01   -1.244725e-01
  3.480000e+00    -7.348122e-01   -1.329182e-01
  3.490000e+00    -4.943901e-01   -1.390642e-01
  3.500000e+00    -2.330135e-01   -1.427013e-01
  3.510000e+00    4.791367e-02    -1.436268e-01
  3.520000e+00    3.445106e-01    -1.416646e-01
  3.530000e+00    6.493964e-01    -1.366951e-01
  3.540000e+00    9.512155e-01    -1.286920e-01
  3.550000e+00    1.235432e+00    -1.177588e-01
  3.560000e+00    1.486757e+00    -1.041479e-01
  3.570000e+00    1.692530e+00    -8.825142e-02
  3.580000e+00    1.845476e+00    -7.056139e-02
  3.590000e+00    1.944452e+00    -5.161175e-02
  3.600000e+00    1.993152e+00    -3.192373e-02
  3.610000e+00    1.997875e+00    -1.196860e-02
  3.620000e+00    1.965485e+00    7.848205e-03
  3.630000e+00    1.902135e+00    2.718631e-02
  3.640000e+00    1.812696e+00    4.576046e-02
  3.650000e+00    1.700664e+00    6.332726e-02
  3.660000e+00    1.568281e+00    7.967199e-02
  3.670000e+00    1.416738e+00    9.459708e-02
  3.680000e+00    1.246380e+00    1.079127e-01
  3.690000e+00    1.056920e+00    1.194292e-01
  3.700000e+00    8.476591e-01    1.289521e-01
  3.710000e+00    6.177980e-01    1.362794e-01
  3.720000e+00    3.668806e-01    1.412027e-01
  3.730000e+00    9.546592e-02    1.435145e-01
  3.740000e+00    -1.939464e-01   1.430221e-01
  3.750000e+00    -4.958433e-01   1.395731e-01
  3.760000e+00    -8.008621e-01   1.330896e-01
  3.770000e+00    -1.095862e+00   1.236060e-01
  3.780000e+00    -1.365538e+00   1.112990e-01
  3.790000e+00    -1.595484e+00   9.649387e-02
  3.800000e+00    -1.775482e+00   7.963905e-02
  3.810000e+00    -1.901358e+00   6.125485e-02
  3.820000e+00    -1.974631e+00   4.187490e-02
  3.830000e+00    -2.000580e+00   2.199885e-02
  3.840000e+00    -1.985996e+00   2.065968e-03
  3.850000e+00    -1.937500e+00   -1.755151e-02
  3.860000e+00    -1.860642e+00   -3.654222e-02
  3.870000e+00    -1.759603e+00   -5.464344e-02
  3.880000e+00    -1.637231e+00   -7.162761e-02
  3.890000e+00    -1.495220e+00   -8.728986e-02
  3.900000e+00    -1.334313e+00   -1.014375e-01
  3.910000e+00    -1.154514e+00   -1.138817e-01
  3.920000e+00    -9.553006e-01   -1.244307e-01
  3.930000e+00    -7.358777e-01   -1.328866e-01
  3.940000e+00    -4.955485e-01   -1.390438e-01
  3.950000e+00    -2.342622e-01   -1.426928e-01
  3.960000e+00    4.658621e-02    -1.436312e-01
  3.970000e+00    3.431296e-01    -1.416826e-01
  3.980000e+00    6.480050e-01    -1.367269e-01
  3.990000e+00    9.498738e-01    -1.287375e-01
  4.000000e+00    1.234211e+00    -1.178171e-01
  4.010000e+00    1.348035e+00    -1.049059e-01
  4.020000e+00    1.434001e+00    -9.099571e-02
  4.030000e+00    1.763964e+00    -7.500588e-02
  4.040000e+00    2.271569e+00    -5.482822e-02
  4.050000e+00    2.828784e+00    -2.932645e-02
  4.060000e+00    3.295038e+00    1.292655e-03
  4.070000e+00    3.589773e+00    3.571671e-02
  4.080000e+00    3.706446e+00    7.219780e-02
  4.090000e+00    3.669744e+00    1.090788e-01
  4.100000e+00    3.500182e+00    1.449284e-01
  4.110000e+00    3.204318e+00    1.784509e-01
  4.120000e+00    2.774834e+00    2.083466e-01
  4.130000e+00    2.189913e+00    2.331704e-01
  4.140000e+00    1.410468e+00    2.511723e-01
  4.150000e+00    3.846573e-01    2.601479e-01
  4.160000e+00    -9.007856e-01   2.575673e-01
  4.170000e+00    -2.274652e+00   2.416901e-01
  4.180000e+00    -3.356009e+00   2.135368e-01
  4.190000e+00    -3.915062e+00   1.771814e-01
  4.200000e+00    -4.055733e+00   1.373274e-01
  4.210000e+00    -3.953885e+00   9.727935e-02
  4.220000e+00    -3.701269e+00   5.900358e-02
  4.230000e+00    -3.330308e+00   2.384569e-02
  4.240000e+00    -2.845787e+00   -7.034781e-03
  4.250000e+00    -2.237786e+00   -3.245264e-02
  4.260000e+00    -1.486267e+00   -5.107291e-02
  4.270000e+00    -5.692806e-01   -6.135064e-02
  4.280000e+00    5.045736e-01    -6.167418e-02
  4.290000e+00    1.624227e+00    -5.103018e-02
  4.300000e+00    2.552139e+00    -3.014835e-02
  4.310000e+00    3.086544e+00    -1.954931e-03
  4.320000e+00    3.219008e+00    2.957283e-02
  4.330000e+00    3.053501e+00    6.093538e-02
  4.340000e+00    2.672575e+00    8.956576e-02
  4.350000e+00    2.107294e+00    1.134651e-01
  4.360000e+00    1.350842e+00    1.307558e-01
  4.370000e+00    3.790633e-01    1.394053e-01
  4.380000e+00    -7.981544e-01   1.373099e-01
  4.390000e+00    -2.029018e+00   1.231740e-01
  4.400000e+00    -3.006532e+00   9.799624e-02
  4.410000e+00    -3.524682e+00   6.534017e-02
  4.420000e+00    -3.636264e+00   2.953545e-02
  4.430000e+00    -3.482441e+00   -6.058080e-03
  4.440000e+00    -3.149646e+00   -3.921851e-02
  4.450000e+00    -2.668403e+00   -6.830876e-02
  4.460000e+00    -2.036189e+00   -9.183172e-02
  4.470000e+00    -1.230479e+00   -1.081651e-01
  4.480000e+00    -2.255167e-01   -1.154450e-01
  4.490000e+00    9.535994e-01    -1.118046e-01
  4.500000e+00    2.132755e+00    -9.637285e-02
  4.510000e+00    3.017959e+00    -7.061928e-02
  4.520000e+00    3.448993e+00    -3.828452e-02
  4.530000e+00    3.497503e+00    -3.552032e-03
  4.540000e+00    3.292573e+00    3.039835e-02
  4.550000e+00    2.907995e+00    6.140119e-02
  4.560000e+00    2.366183e+00    8.777209e-02
  4.570000e+00    1.657937e+00    1.078927e-01
  4.580000e+00    7.569600e-01    1.199672e-01
  4.590000e+00    -3.484448e-01   1.220097e-01
  4.600000e+00    -1.570178e+00   1.124166e-01
  4.610000e+00    -2.648944e+00   9.132103e-02
  4.620000e+00    -3.319205e+00   6.148028e-02
  4.630000e+00    -3.547413e+00   2.714719e-02
  4.640000e+00    -3.461646e+00   -7.898104e-03
  4.650000e+00    -3.168924e+00   -4.105095e-02
  4.660000e+00    -2.715322e+00   -7.047218e-02
  4.670000e+00    -2.106377e+00   -9.458068e-02
  4.680000e+00    -1.323201e+00   -1.117286e-01
  4.690000e+00    -3.390657e-01   -1.200399e-01
  4.700000e+00    8.311525e-01    -1.175795e-01
  4.710000e+00    2.031066e+00    -1.032684e-01
  4.720000e+00    2.965559e+00    -7.828525e-02
  4.730000e+00    3.447580e+00    -4.621955e-02
  4.740000e+00    3.532370e+00    -1.131980e-02
  4.750000e+00    3.353211e+00    2.310810e-02
  4.760000e+00    2.991133e+00    5.482982e-02
  4.770000e+00    2.473286e+00    8.215192e-02
  4.780000e+00    1.793698e+00    1.034868e-01
  4.790000e+00    9.273228e-01    1.170919e-01
  4.800000e+00    -1.442914e-01   1.210071e-01
  4.810000e+00    -1.358326e+00   1.134940e-01
  4.820000e+00    -2.482322e+00   9.429078e-02
  4.830000e+00    -3.231321e+00   6.572257e-02
  4.840000e+00    -3.527202e+00   3.192996e-02
  4.850000e+00    -3.485136e+00   -3.131732e-03
  4.860000e+00    -3.221974e+00   -3.666728e-02
  4.870000e+00    -2.792955e+00   -6.674193e-02
  4.880000e+00    -2.209052e+00   -9.175197e-02
  4.890000e+00    -1.454516e+00   -1.100698e-01
  4.900000e+00    -5.019904e-01   -1.198523e-01
  4.910000e+00    6.456663e-01    -1.191340e-01
  4.920000e+00    1.859204e+00    -1.066096e-01
  4.930000e+00    2.852672e+00    -8.305023e-02
  4.940000e+00    3.405278e+00    -5.176049e-02
  4.950000e+00    3.541631e+00    -1.702594e-02
  4.960000e+00    3.396051e+00    1.766247e-02
  4.970000e+00    3.059423e+00    4.993984e-02
  4.980000e+00    2.565621e+00    7.806506e-02
  4.990000e+00    1.912765e+00    1.004570e-01
  5.000000e+00    1.077766e+00    1.154096e-01
  5.010000e+00    3.784220e-02    1.209877e-01
  5.020000e+00    -1.164393e+00   1.153549e-01
  5.030000e+00    -2.323473e+00   9.791560e-02
  5.040000e+00    -3.143898e+00   7.057874e-02
  5.050000e+00    -3.506084e+00   3.732883e-02
  5.060000e+00    -3.508033e+00   2.258249e-03
  5.070000e+00    -3.274540e+00   -3.165462e-02
  5.080000e+00    -2.869958e+00   -6.237711e-02
  5.090000e+00    -2.310816e+00   -8.828097e-02
  5.100000e+00    -1.584724e+00   -1.077587e-01
  5.110000e+00    -6.645659e-01   -1.190051e-01
  5.120000e+00    4.566032e-01    -1.200449e-01
  5.130000e+00    1.676110e+00    -1.093814e-01
  5.140000e+00    2.723861e+00    -8.738152e-02
  5.150000e+00    3.349681e+00    -5.701381e-02
  5.160000e+00    3.542344e+00    -2.255369e-02
  5.170000e+00    3.433122e+00    1.232364e-02
  5.180000e+00    3.122960e+00    4.510405e-02
  5.190000e+00    2.653175e+00    7.398473e-02
  5.200000e+00    2.026363e+00    9.738242e-02
  5.210000e+00    1.221851e+00    1.136235e-01
  5.220000e+00    2.141115e-01    1.208033e-01
  5.230000e+00    -9.713906e-01   1.170169e-01
  5.240000e+00    -2.157449e+00   1.013727e-01
  5.250000e+00    -3.045837e+00   7.535628e-02
  5.260000e+00    -3.476830e+00   4.274295e-02
  5.270000e+00    -3.525735e+00   7.730120e-03
  5.280000e+00    -3.323320e+00   -2.651516e-02
  5.290000e+00    -2.943500e+00   -5.784926e-02
  5.300000e+00    -2.408798e+00   -8.461075e-02
  5.310000e+00    -1.710472e+00   -1.052071e-01
  5.320000e+00    -8.223975e-01   -1.178714e-01
  5.330000e+00    2.699002e-01    -1.206339e-01
  5.340000e+00    1.488282e+00    -1.118430e-01
  5.350000e+00    2.583690e+00    -9.148316e-02
  5.360000e+00    3.282898e+00    -6.215022e-02
  5.370000e+00    3.535605e+00    -2.805771e-02
\end{filecontents*}
\pgfplotstablegetrowsof{tabledata.dat}
\let\datacount\pgfplotsretval

\begin{document}

\begin{animateinline}[controls]{25}
\multiframe{\datacount}{idx=0+1}{
  \begin{tikzpicture}
    \begin{axis}[
        grid = major,
        xmin=-4, xmax=4,
        ymin=0, ymax=6,
        zmin=-0.2, zmax=0.3,
      ]
      \addplot3 [
        color = blue, mark=none,
        unbounded coords=jump,
        x filter/.expression={\coordindex>\idx ? nan : \thisrow{u_C}},
        y filter/.expression={\coordindex>\idx ? nan : \thisrow{t}},
        z filter/.expression={\coordindex>\idx ? nan : \thisrow{i_L}},
      ]
      table {tabledata.dat};
    \end{axis}
  \end{tikzpicture}
}
\end{animateinline}
\end{document}

Below, a size-optimized version (PDF smaller by 1/3) based on the xsavebox package. The static parts (axes, grid, ticks) are rendered once into a PDF XObject. Later, a reference is inserted as backround image and the curve is drawn on top.

%% for SVG:
%% dvilualatex <file>.tex
%% dvilualatex <file>.tex
%% dvisvgm --zoom=-1 --font-format=woff --exact --precision=1 <file>.dvi

%\documentclass[dvisvgm]{article} %
%\pagestyle{empty}

% for PDF: lualatex, xelatex, pdflatex, latex+dvips+ps2pdf
\documentclass{standalone}

\usepackage{animate,xsavebox}
\usepackage{tikz,pgfplots,pgfplotstable}
\pgfplotsset{compat=newest}

\pgfplotstablegetrowsof{tabledata.dat}
\let\datacount\pgfplotsretval

\begin{document}

% save common parts (axes, grid, ticks) in an xlrbox
\begin{xlrbox}{axes}
  \begin{tikzpicture}
    \begin{axis}[
        grid = major,
        xmin=-4, xmax=4,
        ymin=0, ymax=6,
        zmin=-0.2, zmax=0.3,
      ]
    \end{axis}
    % save bounding box coords
    \pgfpointanchor{current bounding box}{south west}\pgfgetlastxy{\macrox}{\macroy}
    \xdef\bboxSW{\macrox,\macroy}
    \pgfpointanchor{current bounding box}{north east}\pgfgetlastxy{\macrox}{\macroy}
    \xdef\bboxNE{\macrox,\macroy}
  \end{tikzpicture}
\end{xlrbox}%
%
\begin{animateinline}[controls]{25}
\multiframe{\datacount}{idx=0+1}{
  \makebox[0pt][l]{\xusebox{axes}}% coord sytem as background
  \begin{tikzpicture} % growing curve on top
    \begin{axis}[
        xmin=-4, xmax=4,
        ymin=0, ymax=6,
        zmin=-0.2, zmax=0.3,
        hide axis % show curve only
      ]
      \addplot3 [
        color = blue, mark=none,
        unbounded coords=jump,
        x filter/.expression={\coordindex>\idx ? nan : \thisrow{u_C}},
        y filter/.expression={\coordindex>\idx ? nan : \thisrow{t}},
        z filter/.expression={\coordindex>\idx ? nan : \thisrow{i_L}},
      ]
      table {tabledata.dat};
    \end{axis}
    \useasboundingbox (\bboxSW) rectangle (\bboxNE);
  \end{tikzpicture}
}
\end{animateinline}
\end{document}
9
  • 1
    Please add \end{document}. BTW, you can find out how many rows the file has with pgfplotstables \pgfplotstablegetrowsof.
    – user194703
    Jan 27, 2020 at 19:59
  • @Schrödinger'scat Thank you, I incorporated your suggestion.
    – AlexG
    Jan 27, 2020 at 20:15
  • thank you for the suggestion. So I have compiled your suggested code and when I open the compiled Pdf with adobe acrobat, the file does not seem to run; am I not seeing something ?
    – Bakr
    Jan 27, 2020 at 21:31
  • @BakrAl-Beattie Did you run pdflatex twice?
    – AlexG
    Jan 27, 2020 at 21:34
  • @BakrAl-Beattie Also try lualatex instead of pdflatex. Compilation may take a while.
    – AlexG
    Jan 27, 2020 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.