【发布时间】:2017-09-22 21:30:17
【问题描述】:
我想确定估计模型与未来新数据的拟合程度。为此,经常使用预测误差图。基本上,我想比较测量输出和模型输出。我使用最小均方算法作为均衡技术。有人可以帮助绘制模型和测量数据之间的比较的正确方法是什么?如果估计值接近真实,那么曲线应该非常接近。下面是代码。 u 是均衡器的输入,x 是接收到的噪声信号,y 是均衡器的输出,w 是均衡器的权重。是否应该使用x 和y*w 绘制图形?但是x 很吵。我很困惑,因为测量的输出x 有噪声,而模型输出y*w 是无噪声的。
%% Channel and noise level
h = [0.9 0.3 -0.1]; % Channel
SNRr = 10; % Noise Level
%% Input/Output data
N = 1000; % Number of samples
Bits = 2; % Number of bits for modulation (2-bit for Binary modulation)
data = randi([0 1],1,N); % Random signal
d = real(pskmod(data,Bits)); % BPSK Modulated signal (desired/output)
r = filter(h,1,d); % Signal after passing through channel
x = awgn(r, SNRr); % Noisy Signal after channel (given/input)
%% LMS parameters
epoch = 10; % Number of epochs (training repetation)
eta = 1e-3; % Learning rate / step size
order=10; % Order of the equalizer
U = zeros(1,order); % Input frame
W = zeros(1,order); % Initial Weigths
%% Algorithm
for k = 1 : epoch
for n = 1 : N
U(1,2:end) = U(1,1:end-1); % Sliding window
U(1,1) = x(n); % Present Input
y = (W)*U'; % Calculating output of LMS
e = d(n) - y; % Instantaneous error
W = W + eta * e * U ; % Weight update rule of LMS
J(k,n) = e * e'; % Instantaneous square error
end
end
【问题讨论】:
-
如何应该绘制取决于你想在你的情节中显示什么......
标签: matlab signal-processing curve-fitting least-squares equalizer