% wave2dtrigcs % usage: wave2dtrigcs(m,n,k,l); % show real cosine-sine pure 2d waveform % % m,n: number of rows and columns of the image matrix % k,l: vertical and horizontal frequencies % S. Allen Broughton - 23 Sep 2010 function wave2dtrigcs(m,n,k,l); tm = (0:1:(m-1))/m; % vertical sampletimes tn = (0:1:(n-1))/n; % horizontal sampletimes % define wave wave = cos(2*pi*k*tm')*sin(2*pi*l*tn); % display results as images subplot(1,2,1); imagesc(wave) title('cosxsin wave'); axis square colormap(gray) % display results as 3D plots subplot(1,2,2); mesh(wave); axis([0,m-1,0,n-1,-1,1]); title('cosxsin wave'); colormap(gray)