displaying symbolic gradient and divergence of vectors and tensors

5 vues (au cours des 30 derniers jours)
Alex
Alex le 17 Avr 2019
I am looking for a way to calculate the divergence and gradient of vector fields without defining the exact expression for them; I mean getting the answer in the following form:
Is it possible to get such results by MATLAB?

Réponses (1)

RICARDO DE BRAGANCA
RICARDO DE BRAGANCA le 20 Oct 2019
May not be exactly what you want but... you can do:
syms f(x1,x2,x3)
gradient(f)
and you will got:
ans(x1, x2, x3) =
diff(f(x1, x2, x3), x1)
diff(f(x1, x2, x3), x2)
diff(f(x1, x2, x3), x3)

Community Treasure Hunt

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

Start Hunting!

Translated by