gusucode.com > 仿真实现噪声调幅干扰信号matlab源码程序 > 仿真实现噪声调幅干扰信号/jam_am.m

    function [resf_exp]=jam_am() 
close all;
%f0-carrier frequence,fai-initial phase 
%t-sample time point ,mfe-efficiency modulate coefficient   
f0=5.3e9; 
fs=32.317e6; 
mfe=5; 
fai=2*pi*rand; 
% t1=100e-6; 
fn=10e6; 
Uj=5;
t=5e-3;

t1=0:1/fs:t-1/fs; 
N=length(t1); 
Kfm=mfe*fn; 
noise=randn(1,N); 
%digits(50)%设定数字精度
f_floor = -10.0;
f_ceil = 10.0;
mu = 5;
sigma = 0;
X = zeros(1,100);
for n = 1:N
prob = 0;
y = rand();
while prob < y;
    x = f_floor + (f_ceil - f_floor) * rand();
    prob = 1/sqrt(2*pi*sigma*sigma)*exp(-(x-mu)^2/sigma/sigma/2);
    y = rand();
end;
X(n) = x;
end;

% n_integral=floor(noise); 
% un=Uj*n_integral.*t1; 
resf_exp=(Uj + X).*exp(j*(2*pi*f0*t1+fai)); 
pinpu=abs(fftshift(fft(resf_exp)));
resf=real(resf_exp);
subplot(2,1,1)
plot(resf)
subplot(2,1,2)
plot(pinpu)