function [zp] = lvdemo_vel4quiv(t,z,lvs,circs) % The velocity field to be used for the quiver plot for line % vorticies demo. % IMPORTANT: !!it is not appropriate to use this function for the % odefile!! this is because the lvs parameter will be fixed % during any ode45 call. trust me just don't do it. % this code is nasty % don't read it - actually just don't read the perturbation by % not(MASK) % also it will occasionally cause a div by zero in lvdemo when % the velocity field is divided by its magnitude. % VORTEX_RAD_SQ specifies the square of the radius of an area % around each line vortex where the effects of that particular LV % are not felt. global VORTEX_RAD_SQ; MASK = (lvdemo_dist(z,lvs(1)) > VORTEX_RAD_SQ); zp = -i*circs(1)/2*pi * MASK .* 1./(z - lvs(1) + not(MASK)); for j = 2:length(lvs) MASK = (lvdemo_dist(z,lvs(j)) > VORTEX_RAD_SQ); zp = zp - i*circs(j)/2*pi * MASK .* 1./(z - lvs(j) + not(MASK)); end zp = conj(zp);