Rowan-Classes/8th-Semester-Spring-2025/clinic-consultant/labs/lab-1/lab1q1.m
2025-01-16 18:34:22 -05:00

17 lines
536 B
Matlab

% Lab 1
% Question 1 on aliasing
fs=100; % Sampling frequency [Hz]
ts=1/fs; % Sampling period [s]
n=0:1:9; % Sample indicies
x20(n+1)=cos(2*pi*20*n*ts); % x[n] with f = 20 [Hz]
x80(n+1)=cos(2*pi*80*n*ts); % x[n] with f = 80 [Hz]
subplot(211) % Start top sub plot
stem(n,x20,'linewidth',2) % Plot samples of x[n] with f = 20[Hz] for all n
subplot(212) % Start bottom sub plot
stem(n,x80,'linewidth',2) % Plot samples of x[n] with f = 80[Hz] for all n
xlabel('f = 20 and 80 Hz'); % Label the x axis