% % w01drift.m - drift (djm: 07 jan 10) % % clear everything & set parameters clear; close all a = 0.8 % coordinates & drift speed plot xx = 0:pi/100:4*pi; uu = 1 ./ (1 + a*sin(xx)); subplot(2,1,1) plot(xx,uu,'k-') axis([0 4*pi 0 1.1*(max(uu))]) title(['\bf drift speed (a=' num2str(a) ')']) xlabel('\bf x-axis') ylabel('\bf u(x)') text( pi/2-0.4,3,'\bf slow') text(3*pi/2-0.4,1,'\bf fast') % three drift paths (x_0 = 0,pi/2,pi) subplot(2,1,2); hold on x_0 = 0; x = x_0:pi/20:4*pi; t = (x - a*cos(x)) - (x_0 - a*cos(x_0)); plot(x,t) x_0 = pi/2; x = x_0:pi/20:4*pi; t = (x - a*cos(x)) - (x_0 - a*cos(x_0)); plot(x,t) x_0 = pi; x = x_0:pi/20:4*pi; t = (x - a*cos(x)) - (x_0 - a*cos(x_0)); plot(x,t) % always label plot & axes axis([0 4*pi 0 4*pi]) title('\bf drift paths') xlabel('\bf X-axis') ylabel('\bf t(X) for 3 IVs') text(1,8,'\bf slope = 1/speed') % lines at time = 3 & 6 plot([0 4*pi],[3 3],'r--') plot([0 4*pi],[6 6],'r--')