Code covered by the BSD License
Avni Pllana (view profile)
14 Aug 2004
18 Aug 2004)
Plots a field line with the initial point P(x0,y0) for a 2D-field.
Watch this File
Plots a field line with the initial point P(x0,y0) for a 2D-field given by an equaly spaced grid of positions and corresponding field components. The function employs the 4th order Runge-Kutta method.
[x,y] = meshgrid(-2:.2:2,-1:.15:1);
z = x .* exp(-x.^2 - y.^2);
[px,py] = gradient(z,.2,.15);
quiver(x,y,px,py), axis image,
it doesn't plot field lines, it plots field vectors.