At each location (x,y), the second derivative of the height of the water is equivalent to the Laplacian of the height field.
or, equivalently,
If you think of bit of water, it rises and falls with an acceleration equivalent to the Laplacian of the height field.
Last week we simulated the trajectory of a single particle under uniform acceleration, this week we will simulate water by calculating the acceleration everywhere and updating all the bits of water at once. In this lab we will continue the pattern of asking you to work out more and more of the details for implementation. The main tasks you need to accomplish are:
>> R
R =
0 0 0 0 0
0 0 0 0 0
0 0 1 0 0
0 0 0 0 0
0 0 0 0 0
>> laplacian(R)
ans =
0 0 0 0 0
0 0 0.2500 0 0
0 0.2500 -1.0000 0.2500 0
0 0 0.2500 0 0
0 0 0 0 0
function [water,waterV] = updateWater(water,waterV,c,dt)This should use the Laplacian of "water" and the constant "c" to compute the acceleration. Then use that acceleration to create the new velocity field.