Divergence, curl and potential function of 2D vector fields
36 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a 2020 Matlab version and I calculated the divergence and the curl of 2D vector fields applying these functions:
- DIV = divergence(X,Y,U,V) computes the divergence of a 2-D, vector field U,V. The arrays X,Y define the coordinates for U,V and must be monotonic and 2-D plaid (as if produced by MESHGRID).
- [CURLZ, CAV]= curl(X,Y,U,V) computes the curl z component and angular velocity perpendicular to z (in radians per time unit) of a 2D vector field U,V. The arrays X,Y define the coordinates for U,V and must be monotonic and 2D plaid (as if produced by MESHGRID).
Now I need to calculate also the potential of these vectors. Matlab provides this function:
- P = potential(V,X) computes the potential of vector field V with respect to X. V and X must be vectors of the same dimension. The vector field V must be a gradient field. If the function potential cannot verify that V is a gradient field, it returns NaN.
But this function seems to accept only symbolic variable as V. How can I calculate the potential of my vector that are made of numeric values and not symbolic variables?
Thank you!!
3 个评论
回答(1 个)
Bjorn Gustavsson
2021-8-19
Ok, if this is only a question abut whether the vector-field is conservative then it is a physics/vector-calculus "home-work" question, so I'll try to point you in the "expected didactic direction": If your vector-field is conservative, then what can you say for sure about its curl or divergence?
If you need to estimate the potential from a gradient vector-field you might have good use of inverse-integrated-gradient that should be as good a solution you can get or use as a starting point for improved estimates if requires.
HTH
2 个评论
Bjorn Gustavsson
2021-8-19
Dont just read - TRY, ponder, test with a vector-field you know to be conservative, and one that you know not to be conservative and compare, ponder some more, for your test-fields you can modify the spacing/resolution of your grids to check how that affects the different numerical tests you run, ponder again, then you will have understood and learnt how this works in a numerical environment and if you add noise to your tests you will kind of anticipate how this will work if applied to experimental data. TRY! (and good luck)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!