% % lab2start.m % % % 1) Create a sine (or cosine) function 2048 points long... % figure(1) clf nx=2048; kc=64/nx; x=0:nx-1; % % now make the function and plot it. % % % 2) Take the fourier transform of the function from 1... % figure(2) clf subplot(5,1,1),plot(x,y); xlabel('x') ylabel('cos(x)') % % generate the wavenumbers % k=-nx/2:nx/2-1; % cy=fftshift(fft(y)); % % 3) create a 2-D array of numbers 400 x 300 using meshgrid... % % % setup the mesh % clear clf colormap('gray') nx=300; x=-nx/2:nx/2-1; ny=400; y=-ny/2:ny/2-1; [X,Y]=meshgrid(x,y); % % set the horizontal wavenumber % kc=20/nx; % % a sine function of x % f=sin(4*pi*X*kc); %