Problem taking curl of a vector field.

1 view (last 30 days)
BCM
BCM on 1 Dec 2021
Answered: Bjorn Gustavsson on 1 Dec 2021
I have four column vectors: X, Y, U, and V which produce a vector field in the x-y plane.
For the ith row, Xi and Yi give the coordinates of a point. Ui and Vi give the x and y components of vector in the x-y plane. Quiver nicely produces a visualization of the vector field.
Ultimately, I would like to take the curl of the vector field. Might anyone have a suggestion on how to get the vector field (currently in 4 individual column vectors) in a form to use the Matlab curl operation?

Answers (1)

Bjorn Gustavsson
Bjorn Gustavsson on 1 Dec 2021
If your sampling-points fall on a nice plaid regular grid then just use reshape to convert X, Y, U and V into 2-D matrices and everything should be fine.
Since you ask I have to assume the points are scattered in the plane and not regular. Then perhaps you get good enough results if you re-interpolate your U-V-field on a regular grid and then call curl on that regularly resampled field. In that case you'll have to check against peculiarities due to reinterpolation, but in regions where you have many samples over the spatial scales of changes in U and V it should be OK?
HTH

Community Treasure Hunt

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

Start Hunting!