% % Filename: example2.m % % Description: This m-file plots various discrete-time sinusoids % to demonstrate periodicity. % n = -10:10; % define n values in a vector x1 = sin(4*n); % define x1[n]=sin(4*n) x2 = cos(4*pi*n/5 + 30*pi/180); % define x2[n]=cos(4*pi*n/5+30deg) x3 = sin(pi*pi*n + 10*pi/180); % define x3[n]=sin(pi*pi*n+10deg) t = -10:0.01:10; % define time values in vector x4c = sin(t); % define continuous time sine x4d = sin(n); % define samlpled version of x4c w/T=1sec subplot(2,2,1) % plot and label first signal stem(n,x1) grid xlabel('n') ylabel('x[n]=sin(4*n)') title('EE342.01: Aperiodic DTS') subplot(2,2,2) % plot and label second signal stem(n,x2) grid xlabel('n') ylabel('x[n]=cos(4*pi*n/5 + 30deg)') title('EE342.01: Periodic DTS') subplot(2,2,3) % plot and label third signal stem(n,x3) grid xlabel('n') ylabel('x[n]=sin(pi*pi*n + 10deg)') title('EE342.01: Aperiodic DTS') subplot(2,2,4) % plot and label fourth signal (cont & sampled) plot(t,x4c); hold stem(n,x4d) hold grid xlabel('t') ylabel('x(t)=sin(t)') title('EE342.01: Sampled with T=1sec')MATLAB Plot Generated: