Skip to content
Snippets Groups Projects
Commit 0f3980aa authored by joemus's avatar joemus
Browse files

tehty kokonaan

parent ca106251
Branches
Tags
No related merge requests found
%a
bk = [0, -0.1, 0.32, 0.5, 0.32, -0.1, 0];
y = [0, 1, 3, 4, 5, 7, 8];
......@@ -8,6 +9,7 @@ plot(y,bk);
M = 7;
hold off;
%b
fs = 1000; %sampling frequency
t = (0:1/fs:1); % Time axis
a0 = 1;
......@@ -18,3 +20,18 @@ f2 = 400;
phi1 = pi;
phi2 = pi/2;
x = a0 + a1*cos(2*pi*f1*t+phi1)+a2*cos(2*pi*f2*t+phi2);
%c
x01 = a0+a1*cos(2*pi*f1*t+phi1); % The lower cosine frequency component and DC of the signal
filterx = filter(bk, 1, x);
filterx = filterx((M/2)+1:end-(M/2));
figure
plot(t, x);
hold on;
plot(t(1:length(filterx)), filterx);
plot(t, x01);
hold off;
legend('Original','Filtered', 'The lower cosine frequency component and DC');
grid on;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment