# Export Animation with Arbitrary Parameter Pairs

I have several functions f_i[a,b,x] I would like to export as an .avi file. They should be plotted with x as the variable and multiple arbitrary parameter pairs {{a1,b1},{a2,b2},...} of the animation. What I tried so far:

Export ["testfile.avi", Table[Table[{
Plot[Sin[(a + x/2)*x], {x, 0, 30}],
Plot[Cos[(a + x/2)*x], {x, 5, 30}],
Plot[b*Cos[(a + x/2)*x + b], {x, 5, 30}]}], {a, 0.1, 1, 0.1}]]


This gives an .avi file where the parameter a is run from 0.1 to 1 in steps of 0.1. However, I would like to have an .avi file, where the plots with the arbitrary parameter pairs {{a1,b1},{a2,b2},...} are displayed in the individual frames. How is the syntax for this?

I do have a table of the parameter pairs in Excel. Is there any way to import them conviniently?

P.S.:The actual functions are a bit more complicated, so this is a simplified example in case you are wondering.

• What do you want with b? it is undefined. Would something like PlotLabel[ ToString[a]<>","<>ToString[b]] work for you? – Ruud3.1415 Jan 24 '18 at 13:43
• a and b are a pairs of arbriary values, which I have saved in an Excel table. – JPK Jan 24 '18 at 14:09
• JPK, welcome to mma.se! We suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign. – kglr Jan 24 '18 at 16:05

You can us

 Export ["testfile.avi", frames1] (* or *)
Export ["testfile.avi", frames2]


where frames1 is obtained using Join on the output of nested Tables:

frames1 = Join @@ Table[Table[{Plot[Sin[(a + x/2)*x], {x, 0, 30}],
Plot[Cos[(a + x/2)*x], {x, 5, 30}], Plot[b*Cos[(a + x/2)*x + b], {x, 5, 30}]},
{b, .1, 1, .1}],
{a, 0.1, 1, 0.1}];


and frames2 is obtained using a single Table with a 2D iterator:

frames2 = Table[{Plot[Sin[(ab[[1]] + x/2)*x], {x, 0, 30}],
Plot[Cos[(ab[[1]] + x/2)*x], {x, 5, 30}],
Plot[ab[[2]]*Cos[(ab[[1]] + x/2)*x + ab[[2]]], {x, 5, 30}]}, {ab,
Tuples[Range[0.1, 1., 0.1], 2]}];

frames1 == frames2


True

• Thank, this is exactly what I was looking for. – JPK Jan 24 '18 at 15:55
• @JPK I know this is far after the fact, but in general if an answer solves your problem it is polite to upvote it and, potentially, accept it as a solution to indicate that your problem was solved. – b3m2a1 Jul 24 '18 at 4:41