Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Лабы / L 4 / L4_1 / 4

.doc
Скачиваний:
35
Добавлен:
16.04.2013
Размер:
98.3 Кб
Скачать

Копоня Юлия Экт-41

ВАРИАНТ 4:1/10,1/40,1 гц .

clf; vn=5;

t=0:1/(vn):50;

x1=sin(2*pi*t/40); x2=sin(2*pi*t/10); x3=sin(2*pi*1*t);

x=x1+x2+x3;

subplot(311);plot(t,x1) subplot(312);plot(t,x1+x2) subplot(313);

plot(t,x) pause

%llh 1/40 .

N=70; Vs=0.035;

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 1 .

N1=20; 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/10 1/40 .

N2=10; 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/10 1/40 .

N3=2; Vs2=0.5;

[b3,a3]=butter(N3,Vs2/vn);

y3=FILTFILT(b3,a3,x); h3=abs(freqz(b3,a3,n));

ff=(1/n)*(0:n-1);

q1=[0 Vs/vn Vs/vn 1]; w1=[1 1 0 0];

q2=[0 Vs1/vn Vs1/vn 1]; w2=[1 1 0 0];

q3=[0 Vs2/vn Vs2/vn 1]; w3=[1 1 0 0];

q4=[0 Vs2/vn Vs2/vn 1]; w4=[0 0 1 1];

subplot(511), plot(t,x); title('ИСХОДНЫЙ СИГНАЛ','FontName','courier');

subplot(512), semilogx(ff,h,q1,w1);

subplot(513), plot(t,y);

subplot(514),plot(ff,h1,q4,w4);

subplot(515), plot(t,y1);xlabel('ВЕРХНЯЯ ЧАСТОТА','FontName','courier');

pause

subplot(411),plot(ff,h2,q2,w2);xlabel('N=10');title('ПЕРЕДАТОЧНОЯ ФУНКЦИЯ ФИЛЬТРА ','FontName','courier');

subplot(412),plot(t,y2);

subplot(413), plot(ff,h3,q3,w3);

subplot(414), plot(t,y3);xlabel('ОТФИЛЬТРОВАННЫЕ ДВА НИЖНИХ СИГНАЛА

ПРИ ПОМОЩИ ФИЛЬТРА БАТЕРВОРДА ','FontName','courier');

Соседние файлы в папке L4_1