How to symbolically calculate the curl of a vector
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!