Home > data-analysis > stats > event > event_proportion.m

event_proportion

PURPOSE ^

event_proportion: the proportion of event in a given time range

SYNOPSIS ^

function p = event_proportion(event, scope)

DESCRIPTION ^

 event_proportion: the proportion of event in a given time range
   USAGE: p = event_proportion(event, scope)
   Input:
     event: (binary) event data;
     scope: the range 
   Output:
     p: the proportion of time in the given range when the event is true.
   Example:
     data = get_variable(52, 'cont_cam1_obj1');
     event = get_variable(52,'event_motion_sensor1_orient');
     p = event_proportion(event, [data(1,1) data(length(data),1)]);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function p = event_proportion(event, scope)
0002 % event_proportion: the proportion of event in a given time range
0003 %   USAGE: p = event_proportion(event, scope)
0004 %   Input:
0005 %     event: (binary) event data;
0006 %     scope: the range
0007 %   Output:
0008 %     p: the proportion of time in the given range when the event is true.
0009 %   Example:
0010 %     data = get_variable(52, 'cont_cam1_obj1');
0011 %     event = get_variable(52,'event_motion_sensor1_orient');
0012 %     p = event_proportion(event, [data(1,1) data(length(data),1)]);
0013 %
0014 event_in_scope = get_event_in_scope(event, scope);
0015 p = event_total_length(event_in_scope) / (scope(2)-scope(1));
0016

Generated on Tue 23-May-2017 03:00:58 by m2html © 2005