%---------------- Editable Variables--------------------------- fs = 10; %Sampling Frequency %-----------------Don't Edit These Variables------------------- f = 5; %Sine Wave Frequency Ts = 1/fs; %Sampling period t = 0:Ts:5; %1st time axis t1 = linspace(0,5, 1000); %2nd time axis x = sin(2*pi*f*(t-0.05)); %Sampled Sine Wave x1 = sin(2*pi*f*(t1-0.05)); %Continuous Sine Wave (Sampled at high freq.) subplot(2,1,1) % Start stem(t, x,'r') % | hold on % | plot(t1, x1,'k') % This Code plots the sampled and hold off % continuous sine wave axis([2 3 -1 1]) % | xlabel('Time(s)') % | ylabel('Amplitude') % end subplot(2,1,2) w = zeros(1,length(t1)); for(i = 1: length(t)) % start for o = 1:length(t1) % | y(o) = x(i)*(sin(pi*fs*(t1(o)-(i/fs)+Ts))/(pi*fs*(t1(o)-(i/fs)+Ts))); end % | w = w+y; % Sinc functions are created and added hold on % | plot(t1, y,'--') % plotted end % end plot(t1, w,'k') %Reconstructed signal is plotted hold off axis([2 3 -1 1]) xlabel('Time(s)') ylabel('Amplitude') %plot is formatted