Rowan-Classes/8th-Semester-Spring-2025/clinic-consultant/labs/lab-2/lab2q2.m
Aidan Sharpe 82b435b6a2 Week 3
2025-02-14 22:27:10 -05:00

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');