%sampling1.m clc clear all close all display('Running sampling1.m...'); %signal bandwidth f=25; %sampling parameters fs=100; ts=1/fs; ws=2*pi*fs; %signal t = 0:ts:10; x = sin(2*pi*f*t); m=50; for k=1:m x=x+ sin(2*pi*f*t*(k-1)/m); end f = (0:length(t)-1)/length(t)-0.5; % Frequency vector mxdb=20*log(abs(fftshift(fft(x)))); figure; subplot(2,1,1) plot(t,x); title('f Hz, fs=100 Hz, time'); axis([0 0.5 -5 5]); subplot(2,1,2) plot(f,mxdb); title('f Hz, fs=100 Hz, freq mag'); axis([-0.5 0.5 -50 150]); display('...done.');