function travelling_wave %This function allows students to visualize a travelling wave in a 1-D %chain of N atoms having a wave vector defined by n (N and n are variables %that can and should be changed). Currently the lattice parameter (a), %spring constant (K), and mass (m) are arbitrarilly set to 1, but can be %changed to evaluate real material properties (this requires a concurrent %change to t, so that an appropriate time step is considered. The %analysis for a 1-D chain comes from Charles Kittel,"Introduction to Solid %State Physics", Chapter 4. warning off; a = 1; a_fine = .01; N = 10; L = N*a; j = 0:1:L/a; j_fine = 0:1:L/a_fine; n = [5]; k = 2.*pi.*n./L; [j_mesh k_mesh] = meshgrid(j,k); [j_fine_mesh k_fine_mesh] = meshgrid(j_fine, k); u = exp(-i.*(-k_mesh.*j_mesh.*a)); u_fine = exp(-i.*(-k_fine_mesh.*j_fine_mesh.*a_fine)); K = 1; m = 1; omega = sqrt(4*K/m)*abs(sin(k.*a./2)); box on; for t = 1:.02:100; plot(j_fine.*a_fine,u_fine.*exp(-i.*omega.*t),'linewidth',2,'color',[1 1 1]); hold on plot(j.*a,u.*exp(-i.*omega.*t),'o','markersize',12,'markerfacecolor',[1 .5 0],'markeredgecolor','k','linewidth',1) hold off set(gca,'fontsize',16,'linewidth',2); xlabel('index') ylabel('displacement (mm)') %axis([0 N -1 1]) pause(.01) end