?? mat_noise_tao.m
字號:
%chapter 2(5) add noise and delay tao0
clear;
%%%%%%%%%%%%%%%%%%%%%%%%1
t=1:0.01:100
T=50;
s1=rectpuls(t,T);
%%%%%%%%%%%%%%%%%%%%%%%%2
f0=0.5;
w0=2*pi*f0;
s2=s1.*cos(w0*t);
%%%%%%%%%%%%%%%%%%%%%%%%3
k=1;
s3=s1.*cos(w0*t+0.5*k*t.^2);
%%%%%%%%%%%%%%%%%%%%%%%%4
N=100;
tao=T/N;
s4=0;
for index=1:N
rect=rectpuls(index*tao,T);
c=round(rand)*2-1;
s4=s4+c*rect.*cos(w0*t);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for s_num=1:4
figure(s_num)
switch s_num
case 1
signal=s1;
case 2
signal=s2;
case 3
signal=s3;
case 4
signal=s4;
end
tao0=1000;
signal_t=[zeros(1,tao0) signal];%delay tao0
[m,n]=size(signal_t);
noise = wgn(m,n,10); % white Gaussian noise
signal_noise=signal_t+noise;
%%%%%%%%%%%%%%%
subplot(221)
plot(signal_t)
xlabel('t');
ylabel('s(t-t0)')
title('signal with tao')
%%%%%%%%%%%%%%%
subplot(222)
plot(signal_noise)
xlabel('t');
ylabel('n(t)');
title('add Gaussian noise')
%%%%%%%%%%%%%%%%%%%%%%%%%%
f1=fft(signal_noise);
f2=fft(fliplr(signal_t));
sig_mat=ifft(f1.*f2);
subplot(223)
plot(fliplr(signal_t));
xlabel('t')
ylabel('h(t)');
title('matched filter')
%%%%%%%%%%%%%%%%%%%
output=ifft(f1.*f2);
subplot(224)
plot(output)
xlabel('t')
ylabel('y(t)')
title('output signal')
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -