www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/QPSKAdaptiveEqualizationExample.m

    %% QPSK Adaptive Equalization
%%
% *Note*: This example runs only in R2016b or later. If you are using an
% earlier release, replace each call to the function with the equivalent
% |step| syntax. For example, myObject(x) becomes step(myObject,x).

%%
% QPSK Adaptive Equalization Using a 32-Coefficient FIR Filter (1000 Iterations)


D = 16;                      % Number of samples of delay
b = exp(1i*pi/4)*[-0.7 1];    % Numerator coefficients of channel
a = [1 -0.7];                % Denominator coefficients of channel
ntr = 1000;                  % Number of iterations
s = sign(randn(1,ntr+D)) + 1i*sign(randn(1,ntr+D)); % Baseband signal
n = 0.1*(randn(1,ntr+D) + 1i*randn(1,ntr+D));       % Noise signal
r = filter(b,a,s)+n;         % Received signal
x = r(1+D:ntr+D);            % Input signal (received signal)
d = s(1:ntr);                % Desired signal (delayed QPSK signal)
mu = 0.1;                    % Step size
po = 4;                      % Projection order
offset = 0.05;               % Offset for covariance matrix
h = dsp.AffineProjectionFilter('Length', 32, ...
    'StepSize', mu, 'ProjectionOrder', po, ...
    'InitialOffsetCovariance',offset);
[y,e] = h(x,d);
subplot(2,2,1); plot(1:ntr,real([d;y;e]));
title('In-Phase Components');
legend('Desired','Output','Error');
xlabel('time index'); ylabel('signal value');
subplot(2,2,2); plot(1:ntr,imag([d;y;e]));
title('Quadrature Components');
legend('Desired','Output','Error');
xlabel('time index'); ylabel('signal value');
subplot(2,2,3); plot(x(ntr-100:ntr),'.'); axis([-3 3 -3 3]);
title('Received Signal Scatter Plot'); axis('square');
xlabel('Real[x]'); ylabel('Imag[x]'); grid on;
subplot(2,2,4); plot(y(ntr-100:ntr),'.'); axis([-3 3 -3 3]);
title('Equalized Signal Scatter Plot'); axis('square');
xlabel('Real[y]'); ylabel('Imag[y]'); grid on;