Files
assignment05/Assignment4_211/assignment4_1.m
2026-06-15 11:10:31 +02:00

34 lines
522 B
Matlab

clc;
clear;
close all;
%% Parameters
f1 = 2000;
f2 = 4000;
f3 = 6000;
f3_rec = -3000
%% Time vectors
t=0:1e-6:1e-3;
%% Signals
x = 1+0.5*cos(2*pi*f1*t)+2*sin(2*pi*f2*t)+sin(2*pi*f3*t);
x1 = 1+0.5*cos(2*pi*f1*t)+2*sin(2*pi*f2*t)+sin(2*pi*f3_rec*t);
x2 = 1+0.5*cos(2*pi*f1*t)+2*sin(2*pi*f2*t)+sin(2*pi*f3*t);
%% Plot
figure
hold on
plot(t, x, 'b', 'LineWidth', 1.5)
plot(t, x1, 'r', 'LineWidth', 1.5)
plot(t, x2, '--g', 'LineWidth', 1.5)
grid on
xlabel('Time (ms)')
ylabel('x(t)')
legend('x(t)', 'x1(t)', 'x2(t)');