% Make a time vector with sampling of 100 Hz time = 0:.01:5; % Make sine waves of different frequencies wavea = 5*sin(1*time*2*pi); waveb = 1*sin(5*time*2*pi); wavec = wavea + waveb; % Plot the sine waves and save plot(time,wavea,'--',time,waveb,'-.',time,wavec,'-'); ylabel('Wave Magnitude') xlabel('Time (seconds)') print -deps run1.eps % Take Fourier Transform of the sine waves ffta = fft(wavea,512); fftb = fft(waveb,512); fftc = fft(wavec,512); % Make a frequency vector based on 100 Hz sampling omega = 0:50/256:50-1/256; % Plot the Fourier Transform and save subplot(311),plot(omega,abs(ffta(1:256))) axis([0 10 0 1500]) xlabel('Frequency (Hz)') subplot(312),plot(omega,abs(fftb(1:256))) axis([0 10 0 1500]) xlabel('Frequency (Hz)') subplot(313),plot(omega,abs(fftc(1:256))) axis([0 10 0 1500]) xlabel('Frequency (Hz)') print -deps run2.eps % Save the data save run.mat