Лабораторная работа № 4
Вариант 18 (по номеру копьютера).
Никонов Владислав Валерьевич ЕКТ-41
% Variant 18 1,3, 45
clf;
t=0:0.001:2;
x1=sin(2*pi*t);
x2=sin(2*pi*t*3);
x3=sin(2*pi*t*45);
x=x1+x2+x3;
plot(t,x),xlabel('sin(2*pi*t)+sin(2*pi*t*3)+sin(2*pi*t*45)');
title('PRODUCED BY NIKOTIN')
pause;
%LF 1/30
N=500;
Vs=1/1000;
b=FIR1(N,Vs);
a=[];
a=[1 a];
n=256;
y=FILTFILT(b,a,x);
h=abs(freqz(b,a,n));
ff=(1/n)*(0:n-1);
%HF 1
N1=50;
Vs1=1/20;
b1=FIR1(N1,Vs1,'high');
a1=[];
a1=[1 a1];
y1=FILTFILT(b1,a1,x);
h1=abs(freqz(b1,a1,n));
%LF 1/10 1/30
N2=50;
Vs2=1/20;
b2=FIR1(N2,Vs2);
a2=[];
a2=[1 a2];
y2=FILTFILT(b2,a2,x);
h2=abs(freqz(b2,a2,n));
ff=(1/n)*(0:n-1);
%LF butter 1/10 1/30
N3=10;
Vs3=1/20;
[b3,a3]=butter(N3,Vs3);
y3=FILTFILT(b3,a3,x);
h3=abs(freqz(b3,a3,n));
ff=(1/n)*(0:n-1);
subplot(311),semilogx(ff,h);xlabel('N=500');title('PRODUCED BY NIKOTIN')
subplot(312), plot(t,x);,xlabel('sin(2*pi*t)+sin(2*pi*t*3)+sin(2*pi*t*45)');
subplot(313),plot(t,y);xlabel('sin(2*pi*t)');
pause;
subplot(311),semilogx(ff,h1);xlabel('N=50');title('PRODUCED BY NIKOTIN')
subplot(312), plot(t,x);,xlabel('sin(2*pi*t)+sin(2*pi*t*3)+sin(2*pi*t*45)');
subplot(313),plot(t,y1);xlabel('sin(2*pi*t*45)');
pause;
subplot(311),semilogx(ff,h2);xlabel('N=50');title('PRODUCED BY NIKOTIN')
subplot(312), plot(t,x);,xlabel('sin(2*pi*t)+sin(2*pi*t*3)+sin(2*pi*t*45)');
subplot(313),plot(t,y2);xlabel('sin(2*pi*t)+sin(2*pi*t*3)');
pause;
subplot(311),semilogx(ff,h3);xlabel('BATTERVORD N=10');title('PRODUCED BY NIKOTIN')
subplot(312),plot(t,x);,xlabel('sin(2*pi*t)+sin(2*pi*t*3)+sin(2*pi*t*45)');
subplot(313),plot(t,y3);xlabel('sin(2*pi*t)+sin(2*pi*t*3)');