# Changes

,  13:07, 22 April 2017
Line 41: Line 41:
ans =

ans =

-0.82502  4.20248  -1.57080

-0.82502  4.20248  -1.57080
+
+
</source>
+
+
<source lang="octave">
+
+
##Demo of how to graph symbolic functions (by converting SYMBOLIC functions into ANONYMOUS functions)
+
##The following code will produce the same vector field plot as Figure 1.14 from Example 1.6 (pg. 39) from A Student's Guide to Maxwell's Equations by Dr. Daniel Fleisch.
+
+
##Make sure symbolic package is loaded and symbolic variables declared.
+
+
syms x y
+
+
##Write a Vector Field Equation in terms of symbolic variables
+
vector = [sin(pi .* y ./2 ); -sin(pi .* x ./2 )];
+
+
##Vector components are converted from symoblic into anonymous form which allows them to be graphed
+
##The '1' & '2', in vector(1) & vector(2) are indeces for the vector.
+
##The " 'vars', [x y]" syntax tells function_handle that each component is a function of both 'x' & 'y'
+
iComponent = function_handle (vector(1), 'vars', [x y]);
+
jComponent = function_handle (vector(2), 'vars', [x y]);
+
+
##Setting the Grid up to graph all axes for all variables from -.5 to .5, with spacings .05 apart.
+
[X,Y] = meshgrid([-.5:.05:.5]);
+
+
##Draw the Vector Field!
+
figure
+
quiver(X,Y,iComponent(X,Y),jComponent(X,Y))

</source>

</source>