[Numpy-discussion] Some help on matlab to numpy translation
Sat Mar 13 04:45:31 CST 2010
Le samedi 13 mars 2010 à 10:20 +0100, Nicolas Rougier a écrit :
> I'm trying to translate a small matlab program for the simulation in a
> 2D flow in a channel past a cylinder and since I do not have matlab
> access, I would like to know if someone can help me, especially on
> array indexing. The matlab source code is available at:
> http://www.lbmethod.org/openlb/lb.examples.html and below is what I've
> done so far in my translation effort.
> In the matlab code, there is a "ux" array of shape (1,lx,ly) and I do
> not understand syntax: "ux(:,1,col)" with "col = [2:(ly-1)]". If
> someone knows, that would help me a lot...
As ux 's shape is (1,lx,ly), ux(:,1,col) is equal to ux(1,1,col) which
is a vector with the elements [ux(1,1,2), ... ux(1,1,ly-1)].
Using ":" juste after the reshape seems a lit bit silly...
LMA UPR CNRS 7051
More information about the NumPy-Discussion