24 lines
457 B
Matlab
24 lines
457 B
Matlab
% Lab 2
|
|
% Question 2 on periodicity
|
|
|
|
% Define the samples axis (0 to 50, including 50)
|
|
n=0:1:50;
|
|
|
|
% Define four cosines at different frequencies
|
|
x1=cos(2*pi*n/7);
|
|
x2=cos(2*pi*n/21);
|
|
x3=cos(2*pi*n/17.5);
|
|
x4=cos(2*n/7);
|
|
|
|
% Plot each of the cosines in a separate subplot
|
|
subplot(411)
|
|
stem(n,x1,'linewidth',2)
|
|
subplot(412)
|
|
stem(n,x2,'linewidth',2)
|
|
subplot(413)
|
|
stem(n,x3,'linewidth',2)
|
|
subplot(414)
|
|
stem(n,x4,'linewidth',2)
|
|
xlabel('n');
|
|
|