MATLAB Answers


Using streamslice/quiver and inpolygon

Asked by Tomas Kojar on 9 Dec 2018
Latest activity Edited by Tomas Kojar on 9 Dec 2018
Suppose we have quiver field i.e. we have a meshgrid and then we assign a vector to each point. Is it possible to plot only the quiver field within some polygon? So in the figure below, I want everything outside the triangle to be cropped out.
Ideally the code will also be helpful for the next step of having multiple such polygons and cropping out everything on their complement.
Some approaches:
a)a direct way is to figure out the meshgrid for the particular polygon and then assign a vector to each point. But that will take a lot of time to figure out as polygons get more complicated
b)use inpolygon. The input of inpolygon are points in (x,y). But in my case I only have the vector field. One idea is to solve the ode system to obtain concrete solution pairs (x,y) to plug into the polygon. But solving them takes a lot longer and the pictures are not as nice.


Sign in to comment.

0 Answers