- use jmod
git-svn-id: http://moon:8086/svn/matlab/trunk@136 801c6759-fa7c-4059-a304-17956f83a07c
This commit is contained in:
+9
-4
@@ -80,20 +80,25 @@ for n=1:N,
|
|||||||
_omega(n) = omega;
|
_omega(n) = omega;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function y = jmod(x)
|
||||||
|
y = x - fix(x);
|
||||||
|
y = y + 0^(0.5 + sign(y)/2);
|
||||||
|
endfunction
|
||||||
|
|
||||||
function perr = phase_det(lo, x)
|
function perr = phase_det(lo, x)
|
||||||
lo = mod(lo - 0.5, 1);
|
lo = jmod(lo - 0.5);
|
||||||
perr = mod((lo - x), 1) - 0.5;
|
perr = jmod(lo - x) - 0.5;
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function phase_out = process_linear_phase(phase_in, omega)
|
function phase_out = process_linear_phase(phase_in, omega)
|
||||||
phase_out = mod(phase + omega, 1);
|
phase_out = jmod(phase + omega);
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function [phase_out, y] = process_trigon(y, omega)
|
function [phase_out, y] = process_trigon(y, omega)
|
||||||
b = 2.0 * sin(pi*omega);
|
b = 2.0 * sin(pi*omega);
|
||||||
y(1) = y(1) - b*y(2);
|
y(1) = y(1) - b*y(2);
|
||||||
y(2) = y(2) + b*y(1);
|
y(2) = y(2) + b*y(1);
|
||||||
phase_out = mod(0.5 + 0.5*atan2(y(1), -y(2))/pi, 1);
|
phase_out = jmod(0.5 + 0.5*atan2(y(1), -y(2))/pi);
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
close all;
|
close all;
|
||||||
|
|||||||
Reference in New Issue
Block a user