function [dutyCycle] = timeDomainSignal2DutyCycle(Xin,Yin)
% Function that returns the duty cycle (i.e. ratio of pulse width to pulse period )for input signal represented by [Xin,Yin],
% OUTPUT
% dutyCycle= vector of duty cycle values for the input signal
%
% INPUTS:
% Xin= vector of time points for the input signal 
% Yin= vector of signal values corresponding to the time vector Xin

% Copyright 2020, The MathWorks, Inc.
if(length(Xin) ~= length(Yin))
    error(message('msblks:msblksMessages:SignalDataMismatch','[Xin Yin]'));
    %error('Length of time vector should be equal to the length of signal value vector');
end
% Using the 'dutycycle' command from signal processing toolbox.
dutyCycle=dutycycle(Yin,Xin);