git-svn-id: http://moon:8086/svn/matlab/trunk@14 801c6759-fa7c-4059-a304-17956f83a07c
34 lines
537 B
Matlab
34 lines
537 B
Matlab
function cfoml_eval(x)
|
|
|
|
N = 1024; % number of subcarriers
|
|
M = 103; % number of subcarriers that carry information
|
|
omega = 2*pi/N; % carrier spacing
|
|
|
|
fa = 48000;
|
|
fo = 0.0;
|
|
|
|
x = 0.5*exp(i*2*pi.*(0:length(x)-1)'*fo/fa) .* x;
|
|
|
|
U = exp(i*omega*(0:N-1)'*(0:N-1));
|
|
|
|
W = U(:, 1:M);
|
|
V = U(:, (M+1):N);
|
|
|
|
phi = 0;
|
|
dphi = pi/100;
|
|
|
|
for j=1:100,
|
|
phik(j) = phi;
|
|
P = calcP(phi, N);
|
|
phi = phi + dphi;
|
|
|
|
S(j) = sum(abs(x'*P*U(:, M+1:N)).^2);
|
|
end
|
|
|
|
close all;
|
|
|
|
plot(phik, real(S)); grid
|
|
|
|
function P = calcP(phi, N)
|
|
P = diag(exp(i*(0:N-1)*phi));
|