clear;clc;close all
M = 1000;
wform = ecg(M)+1;
plot(wform)
axis([0 M -1.25 1.25])

rng default

x = wform + 0.2*randn(1,M);
plot(x)

set(0,'defaulttextinterpreter','Latex');
[B,A,Bcasc,Acasc]=butterworth(1,0.04,0.06,-1,-114,'low');

xnew = IIRcasc(x,Bcasc,Acasc);

figure(1); %Obr 3.2

plot(x(151:950),'Color',[0.2 0.7 0.9]);
hold on;

plot(xnew(151:950),'r','LineWidth',2);
plot(wform(151:950),'k','LineWidth',2);
legend('zašumené EKG','filtrované EKG','EKG');
xlabel('vzorka[-]');
set(gca,'FontSize',25)
