% % plot k(x) % a = 0.5; %a = 1.2; x = 0:pi/50:2*pi; k = x + a*(1-cos(x)); figure(1); clf plot(x,k) title('\bf one period of k(x)','fontweight','bold') xlabel('\bf x'); ylabel('\bf k(x)') axis([0 2 0 2]*pi); axis('square') disp(' pause: hit any key to continue'); pause % % level curves of: k(x) - t = X_0 % x = -pi:pi/50:pi; t = 0:pi/50:2*pi; % make a 2D array of coordinates: x & t [xg, tg] = meshgrid(x,t); % make 2D arrays: X(x,t) & u(x,t) XX = xg + a*(1-cos(xg)) - tg; uu = sin(XX); % vector of values X0 = X(x0,0) x0 = -3*pi:pi/6:3*pi; X0 = x0 + a*(1-cos(x0)); % plot level curves of XX with values X0 figure(1); clf contour(x,t,XX,X0,'k'); title('level curves of: X(x,t) = k(x) - t','fontweight','bold') xlabel('\bf x'); ylabel('\bf t') axis([-1 1 0 2]*pi); axis('square')