?? filter1.m
字號:
%s(t)
clc
clear all;
s=[(0:50)/50,(100-(51:150))/50,((151:199)-200)/50];
n=1:200;
subplot(211)
plot(n,s);
title('發送的原信號s(n)')
%n(t)
n1=5.*randn(1,200);
for m=1:200
h(m)=s(201-m);
end
subplot(212);
plot(n,h);
title('s(n)的匹配濾波器函數h(n)')
%x(t)
x1=s(n)+n1;
x0=n1;
figure(2)
subplot(211);
plot(n,x1);
title('信號x1(n)')
out1=conv(x1,h);
figure(2)
m=1:399;
subplot(212);
plot(m,out1);
title('輸出信號out1(n)')
figure(3)
subplot(211);
plot(n,x0);
title('信號x0(n)')
out2=conv(x0,h);
subplot(212);
plot(m,out2);
title('輸出信號out2(n)')
'有信號時在t=200時刻的判決值為'
out_1=out1(200)
'無信號時在t=200時刻的判決值為'
out_2=out2(200)
figure(4)
subplot(211)
plot(m,out1)
title('匹配濾波器處理含信號的輸出out1(n)')
subplot(212)
plot(m,out2)
title('匹配濾波器處理不含信號的輸出out2(n)')
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -