📄 demod_iphase.m
字号:
function iphase = demod_iphase (yi,yq)
%Gererate the Instantaneous Phase
%
global k Fc Fd Fs n;
N = length(yi);
iphase = zeros(1,N); % Initialize the iphase.
% if the Inst. Phase is lower than this Threshold, then it's set to 0.
t_phase = 0.001;
%% yq = sin(iphase)
%% yi = cos(iphase)
% Inst. Phase is from -pi to pi.
for i = 1:N
if (abs(yi(i)) <= t_phase);
if yq(i) >= t_phase
iphase(i) = pi/2;
else
iphase(i) = -pi/2;
end
end
if yi(i) < -t_phase
if yq(i) > t_phase
iphase(i) = atan ( yq(i)/yi(i) ) + pi;
end
if yq(i) < -t_phase
iphase(i) = atan ( yq(i)/yi(i) ) - pi;
end
if (abs(yq(i)) <= t_phase)
iphase(i) = pi;
end
end
if yi(i) > t_phase
iphase(i) = atan ( yq(i)/yi(i) );
end
% [i,iphase(i)] % Show the result.
% pause;
end
%figure (921);
%stairs (n, iphase);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -