📄 snrintegtest.m
字号:
clear all
N=4*1024;
fs=12e3;
fc=1e3;
SNR=-25;
sigma=sqrt(10^(-SNR/10));
t=[0:1/fs:1];
f=[-(N/2)+1:N/2]*fs/N;
x=cos(2*pi*fc*t);
SIGNAL=zeros(1,N);
ASIGNAL=zeros(1,N);
for j=1:30
n=sigma*randn(1,length(t));
signal=x+n;
SIGNAL=SIGNAL+fftshift(fft(signal,N));
ASIGNAL=ASIGNAL+abs(fftshift(fft(signal,N)));
end
figure(1)
subplot(211);plot(f,SIGNAL);
subplot(212);plot(f,ASIGNAL);
figure(2)
subplot(321);plot(t,x);
subplot(323);plot(t,n);
subplot(325);plot(t,signal);
X=fftshift(fft(x,N));
subplot(322);plot(f,abs(X));
axis tight
NN=fftshift(fft(n,N));
subplot(324);plot(f,abs(NN));
axis tight
SIGNAL=fftshift(fft(signal,N));
subplot(326);plot(f,abs(SIGNAL));
axis tight
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -