help on plotting results for LBM in matlab

Hi everyone,

ive got my LB code working but im struggling on plotting the results i want in matlab. Im sure its just a few simple mistakes on my part but if anybody you help me out id appreciate it.

The simulation runs in time steps of 0.0067 secs and runs for approx 5.5 secs. I want to plot the water surface height (rho) at the times t=1, t=2, t=3, t=4 and t=5 so ive tried the following…

subplot(2,1,1)
if t>=1;
plot(rho(end/2,:));
hold on
subplot(2,1,1)
if t>=2;
plot(rho(end/2,:));
hold on
…etc to t=>=5

This doesnt seem to plot rho at the discrete times but simply plots rho at all the time steps on the same graph.

One other problem is i want to plot rho as a time series at one particular coordinate showing how it changes over time. I thought to do this for a random point on the mesh would simply be plot(rho(end/2,50));, but again this just plots a blank graphy.

I know this may seem easy to a lot of you and i cant understand why i havent been able to get it to work yet but if any of you can help then that would be great. Thanks.

James.

  • if you want each curve to replace the previous one, you should not use the command “hold on”
  • to be sure the graph is plotted without delay, use the command “drawnow” after plotting
  • if the first subplot command is “subplot(2,1,1)”, shouldn’t the second command be “subplot(2,1,2)”?

It’s a so easy problem
you can find the answer in the matlab help file
there are many examlpes to guide how to use these funtions