我想实现简单的方程。这里 t[n] 是样本数。我要实现的方程是
S=cos(2*pi*fc*t)
S1t[n]=cos(2*pi*fc*t[n]+ ϕ(t[n])
Where ϕ(t[n])= ϕ0(t[n])+∑_(k=0)^n▒ϕ1(t[k])
, 这里求和从 k = 0 到 n
其中 φ0(t[n]) 是具有高斯分布的随机变量 其中 φ0(t[n]) 也是具有高斯分布的随机变量。这就是我实施的方式。请帮助我这是什么错误。提前致谢。
ts = 0.01;
fs = 1/ts;
nsamples = 100;
t = 0:ts:nsamples-ts;
fc = 50;
S = cos(2*pi*fc*t); %%% equation 7.1 noisless
sigma = 1/1000;
phi_sync = sigma * rand(1,nsamples); %%%% random variable with gaussian distributed
for k = 1: nsamples
phi_acc(k,:) = rand(1,nsamples); %%%% random variable with gaussian distributed
phi(k, :) = phi_sync + phi_acc(k,:); %%%% equation 7.11
S1(k,:) = cos(2*pi*fc*t + phi(k,:));
end
%%%% equation 7.10, signal with noise
figure, plot(fftshift(abs(fft(S1))));
return