[Numpy-discussion] Some help on matlab to numpy translation
Friedrich Romstedt
friedrichromstedt at gmail.com
Sat Mar 13 10:59:34 EST 2010
2010/3/13 Nicolas Rougier <Nicolas.Rougier at loria.fr>:
> 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...
It means that you select all in the 0-axis all indices, in the 1-axis
the index 0 (matlab: index 1), and in the 2-axis the indices given by
the list {col}. {col} is in our case an ndarray of .ndim = 1.
I attach a modified version of your script which is running, computing
*something*. If you could provide information about matlab functions
opp() and circshift() that would be helpful. I marked sections I
changed with "CHANGED", todos with TODO and lonely notes with NOTE and
so on.
Friedrich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lbmethod.py
Type: application/octet-stream
Size: 6429 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100313/7ab6022c/attachment.obj>
More information about the NumPy-Discussion
mailing list