%
%   Book: MATLAB-Based Electromagnetics (Pearson Prentice Hall)
%   Author: Branislav M. Notaros
%   Instructor Resources
%   (c) 2011
%
%   This MATLAB code or any part of it may be used only for 
%   educational purposes associated with the book
%
%
%


%    Symbolic gradient in spherical coordinates


function[Ar,Atheta,Aphi] = gradSph(f)
syms r theta phi
Ar = diff(f,r);
Atheta = 1/r*diff(f,theta);
Aphi = 1/r/sin(theta)*diff(f,phi);