% VARIANT вариант 1: 1/20, 1/10,1 гц
clf;
vn=5;
t=0:1/vn:100;
x1=sin(2*pi*t/20);
x2=sin(2*pi*t/10);
x3=sin(2*pi*1*t);
x=x1+x2+x3;
q=[0.07/vn 0.07/vn];
w=[0 1];
%plot(q,w)
%pause
subplot(311),plot(t,x1); subplot(312), plot(t,x);subplot(313),plot(t,x1+x2);
pause
%LF 1/5
N=100;
Vs=0.07;
b=FIR1(N,Vs/vn);
a=[];
a=[1 a];
n=256;
y=FILTFILT(b,a,x);
h=abs(freqz(b,a,n));
ff=(1/n)*(0:n-1);
%HF 10
N1=100;
Vs1=0.5;
b1=FIR1(N1,Vs1/vn,'high');
a1=[];
a1=[1 a1];
y1=FILTFILT(b1,a1,x);
h1=abs(freqz(b1,a1,n));
%LF 1/2 1/5
N2=100;
Vs2=0.5;
b2=FIR1(N2,Vs2/vn);
a2=[];
a2=[1 a2];
y2=FILTFILT(b2,a2,x);
h2=abs(freqz(b2,a2,n));
ff=(1/n)*(0:n-1);
%LF butter 1/2 1/5
N3=10;
Vs3=0.5;
[b3,a3]=butter(N3,Vs3/vn);
y3=FILTFILT(b3,a3,x);
h3=abs(freqz(b3,a3,n));
ff=(1/n)*(0:n-1);
subplot(311),semilogx(ff,h,q,w);xlabel('N=100');title('its made by alexey')
subplot(312), plot(t,x);,xlabel('sin(2*pi*t/20)+sin(2*pi*t/10)+sin(2*pi*1*t)');
subplot(313),plot(t,y);xlabel('sin(2*pi*t/20)');
pause;
subplot(311),plot(ff,h1);xlabel('N=100');
subplot(312), plot(t,x);,xlabel('sin(2*pi*t/20)+sin(2*pi*t/10)+sin(2*pi*1*t)');
subplot(313),plot(t,y1);xlabel('sin(2*pi*t*1)');
pause;
subplot(311),plot(ff,h2);xlabel('N=100');
subplot(312), plot(t,x);,xlabel('sin(2*pi*t/20)+sin(2*pi*t/10)+sin(2*pi*1*t)');
subplot(313),plot(t,y2);xlabel('sin(2*pi*t/20)+sin(2*pi*t/10)');
pause;
subplot(311),plot(ff,h3);xlabel('BATTERVORD N=10');
subplot(312),plot(t,x);,xlabel('sin(2*pi*t/20)+sin(2*pi*t/10)+sin(2*pi*1*t)');
subplot(313),plot(t,y3);xlabel('sin(2*pi*t/20)+sin(2*pi*t/10)');