snrintegtest.m

来自「Test CA-CFAR on FFT of sinusoidal beats 」· M 代码 · 共 37 行

M
37
字号
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 + =
减小字号Ctrl + -
显示快捷键?