0
$\begingroup$

I have some code that's designed to evaluate a function that has two input variables, plot and animate said function in a specific order, and finally export the result. While I can get the function working fine within the notebook, I can't figure out how to properly export the code.

Image of My Code

Subscript[x, 0] = 0
ϕ[x_,t_,c_]=(c/2)*(Sech[0.5*Sqrt[c]*(x-Subscript[x, 0]-c*t)]^2)
Animatation1 = 
Manipulate[Plot[ϕ[x, t, c], {x, 0, 20}, PlotRange -> {0, 3}], {t, 0, 4}, {c, 0, 5}]
Export["Soliton1B.swf", Animatation1]

I evaluated my code, basically in the order shown there, and then used the plus symbol on the manipulate animation to add in bookmarks so that it'll animate in the right order. However, when I go to export the animation, it completely ignores the bookmarks and adjusts only one slider at a time. I've tried with a variety of different output formats with no luck.

Alternatively, is there a way to export a stand-alone manipulable object from this module?

*Note: I am aware that I misspelled "Animatation", it's a long night.

$\endgroup$
6
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 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! $\endgroup$
    – user9660
    Nov 30, 2014 at 7:54
  • 1
    $\begingroup$ Please, post Code not pictures. Consider updating and complementing your question with Code. $\endgroup$
    – user9660
    Nov 30, 2014 at 7:57
  • $\begingroup$ Try adding AutoRun code. See reference.wolfram.com/language/ref/AutorunSequencing.html (if you've posted code instead of images, would be easier to show you). $\endgroup$
    – Nasser
    Nov 30, 2014 at 7:59
  • $\begingroup$ Sorry for the dumb question, but how would I copy the code here? When I try to directly copy and paste, it pastes with some weird formatting. $\endgroup$
    – g11449
    Nov 30, 2014 at 8:03
  • $\begingroup$ Select the cell from your notebook, right-click and copy as text, and paste here. $\endgroup$
    – Nasser
    Nov 30, 2014 at 8:04

1 Answer 1

2
$\begingroup$

This works for me. V 10.01 on windows

SetDirectory[NotebookDirectory[]];
m = Manipulate[
  Plot[phi[x, t, c], {x, 0, 20}, PlotRange -> {0, 3}],
  {t, 0, 4},
  {c, 0, 5},
  AutorunSequencing -> {1, 2},
  Initialization :> 
   (
    x0 = 0;
    phi[x_, t_, c_] := (c/2)*(Sech[0.5*Sqrt[c]*(x - x0 - c*t)]^2);
    )
  ]

and in new cell, just type

Export["m.avi", m]  (*or swf*)

No need to click anything in Manipulate. Autorun does it automatically. You can customize Autorun as shown in help. Change order, timing, etc...

$\endgroup$
3
  • $\begingroup$ Thank you, but that didn't really help with my issue. I basically want the following pattern to occur: c = 0 t goes from 0 to max then back c = 1/4 Way t goes from 0 to max then back c = 1/2 Way t goes from 0 to max then back c = 3/4 Way t goes from 0 to max then back c = Full Way t goes from 0 to max then back $\endgroup$
    – g11449
    Nov 30, 2014 at 8:26
  • $\begingroup$ If you want specific motion, then you have to code it in. Autorun just runs one slider at a time, in the order you specify, as above, with amount of time that you can also specify per control variable. But if all what you want is to make a movie of some specific sliders combinations, why not simply use movie screen capture and run Manipulate yourself while recording it. Then save the movie. This is what I do myself for all my demos I make. Much simpler. (I use camStudio on window. it is free. But there are others) $\endgroup$
    – Nasser
    Nov 30, 2014 at 8:43
  • $\begingroup$ Yeah, that's what I ended up doing. Thanks for all your help! $\endgroup$
    – g11449
    Nov 30, 2014 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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