I am trying to simulate particles determined by velocity. I want to store the present particle location, and step forward by velocity in time, so I can plot the track of the all the particles.

This is the code I have, but it doesn't update the particle positions.

Any help would be great.

dt = .1;

t = 1;

while t < max(time) - dt

```
t = t+1;
% set present particle location
x(t,:) = x(t-1,:);
y(t,:) = y(t-1,:);
% interpolate velocity with the present location
int_u = interp2(lon2d,lat2d,u2d,x(t-1,:),y(t-1,:));
int_v = interp2(lon2d,lat2d,v2d,x(t-1,:),y(t-1,:));
% take the previous position of the particle and step forward
xtrack(t,:) = x(t-1,:) + int_u;
ytrack(t,:) = y(t-1,:) + int_v;
```

end

- Serverfault Help
- Superuser Help
- Ubuntu Help
- Webapps Help
- Webmasters Help
- Programmers Help
- Dba Help
- Drupal Help
- Wordpress Help
- Magento Help
- Joomla Help
- Android Help
- Apple Help
- Game Help
- Gaming Help
- Blender Help
- Ux Help
- Cooking Help
- Photo Help
- Stats Help
- Math Help
- Diy Help
- Gis Help
- Tex Help
- Meta Help
- Electronics Help
- Stackoverflow Help
- Bitcoin Help
- Ethereum Help