【发布时间】:2013-11-01 00:22:42
【问题描述】:
我想在没有任何内置 MATLAB 函数的情况下自动关联随机噪声向量。
我给出的自相关方程是:
Rxx[L] = ∑ from n = 1 to N-1 [x(n)*x(n+L)]
L = [0:200]
我已经编写了下面的代码,但 plot Rxx vs L plot 不是我所期望的。
我希望我的绘图以 L = 0 或 L = 1 的某个最大值开始,因为 MATLAB 的索引从 1 开始。然后呈指数下降并在最小值为零时饱和。
clc
clear all
randn('seed',2496132);
n = randn(1,1024);
upperbound = numel(n)-1;
for L = 1:200
for j = 1 : upperbound
n1(j) = n(j)+L;
Rxx(j) = (n(j)*n1(j));
end
Rxx_sum(L) = sum(Rxx);
Rxx = 0;
end
plot([1:200], Rxx_sum)
【问题讨论】:
标签: matlab correlation