I would like to plot (or to find) an animation where two waves at different frequencies, propagating with different velocities, sum together

$$w_1 (x,t) = \cos(\omega_1 t - k_1 x)\\w_2 (x,t) = \cos(\omega_2 t - k_2 x)$$

and generate the resulting signal

$$w(x,t) = \cos(\omega_1 t - k_1 x) + \cos(\omega_2 t - k_2 x)$$

An envelope and a carrier can be distinguished after some algebra and the animation should show the different propagation velocities of the envelope and the carrier.

1) Is there a site which already provides this? This page (last image) and this page provide different animations and are not suitabile. In fact, the first link (last image of the webpage) doesn't show $w_1$ and $w_2$ moving at different velocities, but just at the same velocity. The second link does never show the three waveforms $w_1$, $w_2$ and $w$ separately

2) Is there a free tool / software / site to generate such an animation?

  • $\begingroup$ Would Mathematica be a better home for this question? $\endgroup$
    – Qmechanic
    Commented Apr 3, 2017 at 8:50
  • $\begingroup$ @Qmechanic My question was not directly asking for a document written with Mathematica, but just for an animation to show a physical phenomenon. The answer provided an excellent Mathematica work, but other answers (with other solutions) are certainly possible. Anyway, if you as a moderator thought this place is better than the original one, I'll adapt to your decision. $\endgroup$
    – BowPark
    Commented Apr 3, 2017 at 9:02
  • 2
    $\begingroup$ For the record, I think that migrating this here was unnecessary and against the formulation of the question, which has no mention of Mathematica and explicitly discourages answers from proprietary platforms. This was perfectly on-topic on physics.se. (CC @Qmechanic) $\endgroup$ Commented Apr 3, 2017 at 9:22

1 Answer 1


If you mean something like this,

Mathematica code through Import["http://halirutan.github.io/Mathematica-SE-Tools/decode.m"]["https://i.sstatic.net/5xgER.png"]

it is essentially trivial to produce using your software platform of choice. This specific example was generated using Mathematica; to get the notebook, run the Import code above.

  • $\begingroup$ Thank you! This is exactly what I asked for. I never used Mathematica, but I downloaded the decode.m file: does it contain all the source needed to plot that animation? And will it work only with Mathematica? $\endgroup$
    – BowPark
    Commented Mar 24, 2017 at 13:59
  • 1
    $\begingroup$ @BowPark No, the decode.m file is part of this package; the notebook is encoded in the image. To get the source, open a notebook, copy from Import until the second ] into a fresh cell, and run it. I can post the plaintext source if you want, but frankly it won't be all that useful outside of Mathematica. $\endgroup$ Commented Mar 24, 2017 at 14:17

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.