How to symbolically calculate the curl of a vector
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Max G
le 16 Nov 2017
Modifié(e) : David Goodmanson
le 16 Nov 2017
so basically i want to do this:
syms E1(x,y,z) E2(x,y,z) E3(x,y,z)
Ecurl=symcurl(x,y,z,E1,E2,E3)
function Ecurl = symcurl(x,y,z,E1,E2,E3)
Ecurl1 = diff(E2,z)-diff(E3,y)
Ecurl2 = diff(E3,x)-diff(E1,z)
Ecurl3 = diff(E1,y)-diff(E2,x)
Ecurl=[Ecurl1 Ecurl2 Ecurl3]
end
with the builtin curl function of matlab. When i try it like this:
syms x y z E1 E2 E3
curl([x,y,z],[E1,E2,E3])
i get a zero vector. And like this:
syms E1(x,y,z) E2(x,y,z) E3(x,y,z)
curl([x,y,z],[E1,E2,E3])
i get an error message that the second argument must be a vector of three variables. In the end i want to be able to use the subs command to assign a specific function to E1 E2 E3 at a later time. Thanks.
0 commentaires
Réponse acceptée
David Goodmanson
le 16 Nov 2017
Modifié(e) : David Goodmanson
le 16 Nov 2017
Hi Max, this appears to work.
>> minusdBdt = curl([E1,E2,E3],[x,y,z])
minusdBdt(x, y, z) =
diff(E3(x, y, z), y) - diff(E2(x, y, z), z)
diff(E1(x, y, z), z) - diff(E3(x, y, z), x)
diff(E2(x, y, z), x) - diff(E1(x, y, z), y)
(It's correct for a right hand coordinate system and opposite in sign from symcurl above)
>>
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Calculus 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!