Rowan-Classes/5th-Semester-Fall-2023/Signals-and-Systems/Labs/Lab-02/Lab2.m
2024-02-22 14:23:12 -05:00

42 lines
578 B
Matlab

% Signal Generation 1
% t = (-25:0.01:25)';
% y = ustep(t,20) - ustep(t,-20);
% Signal Generation 2
% t = (0:0.01:30)';
% y = squarewave(t, 10);
% Signal Generation 3
% t = (0:0.0002:0.3)';
% y = 2*sin(250*pi*t - pi/5);
% Chirps
%t = (0:0.05:40)';
%A = 1;
%omega0 = 2;
% Chirps 1
% s = t.*t./4;
% Chirps 2
% s = -2*sin(t);
% y = A*cos(omega0 * t + s);
% Chirps 3
% Beating/Pulsation
t = (0:0.1:200)';
NP = 51;
dh = 2/NP;
f = (159:dh:161)';
A = 10;
sum = zeros(length(t));
for i = 0:NP
sum = sum + 10*cos(2*pi*f(1)*t);
end
y = sum;
% Common
plot(t, y, "linewidth",5);