Hi!(adsbygoogle = window.adsbygoogle || []).push({});

I'm trying to write a program, to show the vector field of a linear simple wave in shallow water. First, determining the position of a particle i run into a problem when trying to store the data in a vector/array. The equation for this is given below. In this particular case everything is kept constant except the water depth h

for h = 0.1: 0.1: 3

x(h)=xi+H/2*cosh((omega/(sqrt(g*h)))*(zeta+h))/(sinh((omega/(sqrt(g*h)))*h))*sin(omega*t-(omega/(sqrt(g*h)))*xi);

end

I get the following error:

??? Attempted to access x(0.1); index must be a positive integer or logical.

Help is much appreciated...

//Kbka

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Data storage in a for loop in matlab

Loading...

Similar Threads - Data storage loop | Date |
---|---|

Mathematica Chisquare fit to multiple data sets | Aug 4, 2017 |

Matlab Plotting Data | Mar 18, 2017 |

Matlab How to extract data from existing JPEG/TiFF graph? | Oct 27, 2016 |

Matlab Data Analysis: Observation Model Problem | Oct 17, 2016 |

Data Storage in Mathematica | Sep 21, 2008 |

**Physics Forums - The Fusion of Science and Community**