How to StreamPlot using existing grid and velocity arrays

How to StreamPlot using existing grid and velocity arrays



I would like to draw a 2D streamline plot in Mathematica based on existing grids, velocity arrays and start points, which were calculated using Matlab/Python code.



The grids are two vectors of size M and N containing evenly spaced x_i and y_j. The velocity arrays are two M-by-N matrices containing the gradients dot_x and dot(y) at each (x_i,y_j) of the 2D plane. The start points are a L-by-2 array containing the points streamlines should pass. In python, I would directly call streamplot(x, y, dot_x, dot_y, startpoints=startpoints) from matplotlib.pyplot package but this does not give nice figure as Mathematica does.


M


N


x_i


y_j


M-by-N


dot_x


dot(y)


(x_i,y_j)


L-by-2


streamplot(x, y, dot_x, dot_y, startpoints=startpoints)


matplotlib.pyplot



However, the examples I found online are for analytical functions, e.g.,


data = Table[x, y, y, x-x^2, x,-1.5,1.5,0.2, y,-2,2,0.2];
ListStreamPlot[data]



I am new to Mathematica and do not know how to translate the Matlab/Python code to Mathematica. Besides, the code on Matlab is pretty time-consuming so I would rather not run the field functions on Mathematica again.



Is there any way to draw streamline plot using existing arrays? Many thanks.









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế