No BSD License  

Highlights from
timing

from timing by Byung Yoon Min
A timing error detector for Communication systems with simulink.

m_delay3(t,x,u,flag,thre)
function [sys, x0] = m_delay3(t,x,u,flag,thre)

% Discrete fuction
% It operates as sample and hold with clock
% 
% Institute for Advanced Engineering (IAE) 
% Research engineer
% Name : Byung Yoon Min,  1997.3.25.
% E-mail : bymin@iae.re.kr
% Modified 1999.2.20.


if abs(flag)==0
	sys=[0,3,1,2,0,1];
	x0=zeros(3,1);
elseif abs(flag) == 2
		sys(3)=x(2);
		sys(2)=u(2);
	if ((u(2) > thre) & (x(2) ~= u(2)))
            sys(1)=u(1);
%            x(1) = u(1);
	else
		sys(1)=x(1);
	end

elseif flag == 3
   	if ((u(2) > thre) & (x(2) ~= u(2)))
            sys=u(1);
	else
		sys=x(1);
	end
elseif flag == 4
	sys=[];
else
	sys=[];
end

Contact us at files@mathworks.com