So I am trying to find the connection between Forcing Amplitude and Velocity in a differential equation (Which is the part of system of differential equations).

Those system differential equations are $$y''(t)+500y'(t)+100y(t)=-A(\cos(500t)+2\cos(1000t))$$ $$300x'(t)=1000y(t)+500y'(t)-35\tanh(50x'(t))$$

Practically, I am trying to graph the change in parameter $A$ which is Forcing Amplitude, and its effect on $x'(t)$. I am not looking for instantaneous velocity, so for example calculating $x(t)/t$ when $t$ is big enough I think is sufficient.

I succeed to use Manipulate to graph $x(t)$ versus $t$ on various $A$ as below.

Manipulate[{xy = NDSolve[{
 y''[t] + 500 y'[t] + 250 y[t] == -a*(Cos[500 t] + 2*Cos[1000 t]),y[0] == 0, y'[0] == 0,
 333 x'[t] == 250 y[t] + 500*y'[t] - 35*Tanh[50 x'[t]], x[0] == 0},
 {x, y}, {t, 0, 0.1}], Plot[{x[t] /. xy}, {t, 0, 0.1}], 
MaxSteps -> Infinity}, {a, 0, 100}]

EDIT: I might be a bit unclear in writing my question. So my question is : Is it possible to take A as x axis and average velocity x'(t) as y axis?


This can be done in Mathematica via simple function call. You can put NDSolve into a function can relate its parameter and output.

A simple example


Then plot it in a regular way:

Plot[f[k], {k, 0.1, 0.7}]

The result is


here y[t]/t is set at t = 30 and k is the damping parameter. The NumericQ is essential to hold the function until a legitimate Real argument is passed into the function.

| improve this answer | |
  • $\begingroup$ Thank you Shenghui! This is what I am looking for! $\endgroup$ – Dadan Ari Wibowo Nov 21 '13 at 11:13
  • $\begingroup$ If you can explain the function of Block and [[1]], it would be great! $\endgroup$ – Dadan Ari Wibowo Nov 21 '13 at 11:29
  • $\begingroup$ The three scope horsemen in Mathematica are: Block, Module and With. They all have their features. What in common is that they allow you to prevent conflicts between the internal variable of a function with a global variable, which is usually black letters/symbols in input cell. $\endgroup$ – yshk Nov 21 '13 at 19:11

You can try ParametricNDSolve with parameter a

xy = ParametricNDSolve[{y''[t] + 500. y'[t] + 250. y[t] + 
     a*(Cos[500. t] + 2*Cos[1000. t]) == 0, y[0] == 0, y'[0] == 0, 
   250. y[t] + 500.*y'[t] - 35*Tanh[50. x'[t]] - 333. x'[t] == 0, 
   x[0] == 0}, {x, y}, {t, 0, 0.1}, {a}]

And then Plot the solutions

Plot[Evaluate[Table[x'[a][t] /. xy, {a, 1, 8, 1}]], {t, 0, 0.1}, 
 PlotRange -> All]

enter image description here

| improve this answer | |
  • $\begingroup$ Thank you Mataraki. I understand that this is a common approach in this kind of problem. However, it lacks a wider perspective on how the droplet velocity changes when A changes. For example, in the range of A=1 to 100 (stepsize 1) how the velocity behaves is still unclear in this approach. That is why I am interested in calculating x(t) divided by t when t is big enough. $\endgroup$ – Dadan Ari Wibowo Nov 21 '13 at 8:53

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.