How to find gradient of a vector field in matlab symbolic
23 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Chandan
le 12 Déc 2023
Réponse apportée : Chandan
le 13 Déc 2023
I am trying to find gradient of a vector field in matlab symbolic , whose output will be matrix but it am getting error
2 commentaires
Réponse acceptée
Walter Roberson
le 12 Déc 2023
Déplacé(e) : Walter Roberson
le 12 Déc 2023
The fundamental problem you are having is that gradient does not accept a vector the first parameter.
syms x y z
syms u(x,y,z) v(x,y,z) w(x,y,z)
V = [u(x,y,z) v(x,y,z) w(x,y,z)];
S = [x y z];
temp = arrayfun(@(EXPR) gradient(EXPR,S), V, 'uniform', 0);
result(x,y,z) = [temp{:}]
0 commentaires
Plus de réponses (2)
Sulaymon Eshkabilov
le 12 Déc 2023
If you assign an expression for V, you will get this:
clc ; clearvars
syms x y z
syms u(x,y,z) v(x,y,z) w(x,y,z)
V(x,y,z) = 2*u+3*v-w % Some e.g. expression
S = [x y z];
du = gradient(u,S)
dV = gradient(V,S)
% OR simply
dV= gradient(V,[x,y,z])
1 commentaire
Dyuman Joshi
le 12 Déc 2023
V is not a combination of u, v and w, but an array with u, v and w as elements.
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!