%trigonometric waveforms

m = 256  % y samples (# rows)
n = 256  % x samples (# columns)
p = 3  % x frequency
q = 7  % y frequency

x = (0:(m-1))/m; % x  sample points
y = (0:(n-1))/n; % y  sample points


figure(1)
% product form
waveprod = sin(2*pi*q*y')*sin(2*pi*p*x);
subplot(1,2,1)
imshow(waveprod,[])
title('product')

%sum form
wavesum = sin(2*p*pi*ones(m,1)*x+2*pi*q*y'*ones(1,n));
subplot(1,2,2)
imshow(wavesum,[])
title('sum')
