Skip to content

Instantly share code, notes, and snippets.

@stephenHartzell
Created July 26, 2017 02:21
Show Gist options
  • Select an option

  • Save stephenHartzell/049924468f37f84b90ddb5a18c86b0a9 to your computer and use it in GitHub Desktop.

Select an option

Save stephenHartzell/049924468f37f84b90ddb5a18c86b0a9 to your computer and use it in GitHub Desktop.
% Define parameters
Fs = 10; % Sampling Frequency
Ts = 1/Fs; % Sampling Period
N = 32; % Total Number of Samples
n = 0:N-1; % Samples
t = Ts*(n); % Sampled times
y = cos(2*pi*t); % Discrete signal
% Plot the signal and its discrete counter-part
figure
stem(t,y,'filled')
hold on;
% The 'continuous signal' (interpolated and highly sampled signal)
plot(linspace(min(t),max(t),length(0:.01:max(t))),cos(2*pi*(0:.01:max(t))))
title(['Sampled Signal with Fs = ',num2str(Fs)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment