Files
css/semestralka/2.m
2025-11-13 21:45:30 +01:00

30 lines
514 B
Matlab

clc;
close all;
clear all;
f0_ohranicene = [25, 20, 10, 12.5];
% semestralka
rawText = fileread('data6.dat');
nums = regexp(rawText, '[-+]?\d+', 'match');
data = int16(str2double(nums));
Fs = 200;
r = 0.95;
b = 1;
a = 1;
for k = 1:length(f0_ohranicene)
theta = 2*pi*(f0_ohranicene(k)/Fs);
b = conv(b, [1, -2*cos(theta), 1]);
a = conv(a, [1, -2*r*cos(theta), r^2]);
end
figure;
zplane(b, a);
figure;
freqz(b, a);
figure;
freqz(b, a);
filtered_data = filter(b, a, double(data));
plot(filtered_data);