% PlotSinusoid - Plot sinusoidal signals
% 
% This script produces a "nice" plot of a sinusoid. It provides for
% explicit specification of the number of samples in each cycle and the
% number of cycles to plot.

%% Parameters of sinusoid:
A   = 3;      % Amplitude
f   = 10;    % Frequency
phi = -pi/4;   % Phase;

%% Parameters controlling plot:
SamplesPerCycle = 50;
CyclesToPlot    = 5;
StartTime       = -0.2;

fs      = f * SamplesPerCycle;
EndTime = StartTime + CyclesToPlot/f;

%% compute sinusoid
tt = StartTime : 1/fs : EndTime; % Time axis
xx = A*cos(2*pi*f*tt + phi);

%% plot
plot(tt,xx,'o-');
grid;
xlabel( 'Time (s)');
ylabel('s(t)')
