Using streamslice/quiver and inpolygon

9 vues (au cours des 30 derniers jours)
Tomas Kojar
Tomas Kojar le 9 Déc 2018
Modifié(e) : Tomas Kojar le 9 Déc 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.

Réponses (0)

Catégories

En savoir plus sur Vector Fields dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by