How to symbolically calculate the curl of a vector

2 ビュー (過去 30 日間)
Max G
Max G 2017 年 11 月 16 日
編集済み: David Goodmanson 2017 年 11 月 16 日
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.

採用された回答

David Goodmanson
David Goodmanson 2017 年 11 月 16 日
編集済み: David Goodmanson 2017 年 11 月 16 日
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 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by