gradient_sym(V,X,coordinate_system)
This Function calculates the gradient of 3D scalar function in Cartesian, Cylindrical, and Spherical coordinate system.
function gradientSym = gradient _sym(V,X,coordinate_system)
V is the 3D scalar function
X is the parameter which the gradient will calculate with respect to.
coordinate_system is the kind of coordinate system at which the vector field is specified.
the gradient is calculated according to (Engineering Electromagnetics Sixth Edition William H. Hayt, Jr. . John A. Buck)
Example (1):
V=24*cos(pi*y/3)*sin(2*pi*z/3)
gradient_sym(V,[x,y,z],'Cartesian')
Example (2):
V=Vo*exp(-2*r)*sin(3*phi)
gradient_sym(V,[r,phi,z],'Cylindrical')
Example (3):
V=Vo*a/R*cos(2*th)
gradient_sym(V,[R,th,phi],'Spherical')
Cite As
mohamed fekry (2024). gradient_sym(V,X,coordinate_system) (https://www.mathworks.com/matlabcentral/fileexchange/66482-gradient_sym-v-x-coordinate_system), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Mathematics > Linear Algebra >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |