After the basic animation, any of several small enhancements can be added
a) Use Visual Basic to put in a 'button' to re-zero the time
b) Use a VB button to animate the pulse instead of having to press F9
c) Put in a slider (scroll bar) to change the width of the pulse
In cell A3 type delta_t. In cell B3 enter 0.02. Then under Insert/Name/Define set the name of the cell to delta_t
In cell A4 type t, and in cell B4
enter 0. Then name the B4 cell t
just
as you did for delta_t
.
Now in B4 type =t+delta_t. This
is a circular reference, and if you get a message at this point, click
'Cancel'. This tells it you are ok with the circular reference.
In cell A5 type delta_x. In cell B5 then enter 0.05. For cell B5, name it delta_x
In A6 type velocity and in cell B6 enter 2. Name B6 velocity.
The pulse function y(x,t) = A/(B+C0*(x-velocity*t)^2).
Type this in cell D3 as a reminder.
In cell A7 type A, in cell B7,enter
a value of 1 and name cell B7 A.
Cell A8 is to be B. Cell B8
is to have a value 1 and be named B
Cell A9 is to be C0. Cell B9
is to have a value 1 and be named C0
Type x into cell A10, and type y
into cell B10
In cell A11 enter 0. In cell A12
enter =A11+delta_x
In cell B11 enter =A/(B+C0*(A11-velocity*t)^2)
Copy cell B11 down to B12.
Copy A12..B12 down to A111..B111
Select cells A11..B111.
Go to the Chart Wizard (in the middle of the top menu, with colored
vertical bars)
Select XY Scatter Plot,
then select Data Points Connected by Smoothed Lines.
Then click Finish, and the
graph will come up.
Now you are almost ready to animate.
Under Tools/Options/Calculation check Iterations and
set number of iterations to 1.
The button for Automatic calculation should be selected.
Go back to the sheet and press F9. This should increment the time and
the graph should animate.
Note that you can change the pulse speed or direction in the velocity
cell.
I had trouble occasionally with getting the iteration going.
It may be important to do these things in order: typing in a name in column A, then putting in values in column B, then naming the cells in column B, and finally entering =t+delta_tThe graph may be jumpy while animating. To cure this, set the y-axis scale so it doesn't automatically re-scale. Right-click on one of the y-axis values, then select Format Axis. Select Scale and unclick Auto on both the Maximum and Minimum values.
Resetting the time to zero is annoying. One can re-enter 0 in B4, then retype =t+delta_t
Private Sub Label1_Click()
Range("t").Select
ActiveCell.value = 0
ActiveCell.Formula = "=t + delta_t"
End Sub
This will (almost) reset the time -- it resets to delta_t. Several attempts to make it perfect have not worked out.
Click the architect's triangle again to get back to Run Mode. Now you can try out the label and see if it resets the time.
Private Sub Label2_Click()
Dim i As Integer
Range("F1").Select
ActiveCell.Value = 0
For i = 1 To 100
ActiveCell.Value = ActiveCell.Value + 1
Next i
End Sub
This writes a set of integers to cell F1, 100 of them. For reasons I don't understand, (probably because any change to the sheet results in automatic recalculation) 100 time steps will now be run off.
Connect the values in D8 to the contents of C0:
In cell B9 (C0) type =100/D8
Now when you drag the slider around you should see the width of the
pulse changing.