Why do I obtain Nan and Inf when trying to compute the curl of a vector field?
10 views (last 30 days)
Show older comments
Emilio L.
on 29 Jul 2018
Edited: Walter Roberson
on 2 Aug 2018
I want to calculate the vorticity of a flow field for a planar diffuser (simple geometry), then I do curl(x,y,u,v) but the curl that I obtain is Nan or Inf.
Even when I create a grid for a 0º ramp angle (basically a channel with rectangular grid) I obtain that. Grid spacing is not uniform in x-direction.
Thank you.
4 Comments
Accepted Answer
Walter Roberson
on 2 Aug 2018
Edited: Walter Roberson
on 2 Aug 2018
"The arrays X and Y, which define the coordinates for U and V, must be monotonic, but do not need to be uniformly spaced. X and Y must have the same number of elements, as if produced by meshgrid."
The help information is more specific:
The arrays X,Y define the
coordinates for U,V and must be monotonic and 2D plaid (as if
produced by MESHGRID).
However, if you examine x0, x1, they are what would be produced by ndgrid() instead of by meshgrid(). So you need
c = curl(x0.',x1.',u0.',u1.');
surf(x0.', x1.', c, 'edgecolor', 'none')
More Answers (0)
See Also
Categories
Find more on Fluid Dynamics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!