%   Problem 6.2
Fs = input('sampling frequency = ')
Ts=1/Fs;
N=input('N= ')
M=input('M= ')
A=input('A= ')
phi=input('phi= ')
n=1:N;
clear v     %   delete possible old v arrays
%
%   Create the sampled volyage, v.  Since n is an array of N
%   elements, v will be an array of N elements.

v=A*cos(M*2*pi*n/N+phi);
t=0:Ts:(N-1)*Ts;    % t goes from zero to UTP-Ts with 1 point
                    % per sample period.

%   Set up the Plot Legend
As=num2str(A);
As = ['A = ' As];
Ns = ['N = ' num2str(N)];
Ms = ['M = ' num2str(M)];
phis=['phi = ' num2str(phi)];

plot(t,v),legend(As,Ns,Ms,phis)

   