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 个评论
Paola
Paola 2021-8-19
Thank you a lot for your answer. I have some 2D vector force fields and I am studying their features, calculating their divergence and curl. Now I need to determine if they are conservative or non-conservative fields and, according to calculus, "a vector field F is conservative if and only if it has a potential function f with F=∇f". Yes, as also mentioned in this page: https://mathinsight.org/conservative_vector_field_determine you can use the gradient theorem so maybe (hopefully) the gradient function you suggested could work. Nevertheless in the same page it is mentioned that this step could be skip and to go directly to the procedure to determine the potential, that's why I looked up for the "potential" function. For each point of force field, I have the force values of U (16x1) and V (16x1) (the values of the force transducer in two of its axis), and X and Y, that define the space grid in which this values are, as required by the divergence function. How can I use the gradient function with these vector? since the input argument is only one , F, should I first create a matrix where the first column is U and the second is V?
thanks again for your help.

请先登录,再进行评论。

回答(1 个)

Bjorn Gustavsson
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 个评论
Paola
Paola 2021-8-19
Thank you for your answer. Yes, I need to know if the vector-field is conservative. According to calculus I may already get this info from the curl calculation: if curl is 0 then the field is conservative. But then, reading on some math pages, it looks that just taking in consideration the curl value, it may not be accurate...
Bjorn Gustavsson
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 CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by