signal processing project
function alarm = va_detect(indata,SR) % ALARM = va_detect(INDATA,SR) % % Outline of Matlab function to detect ventricular arrhythmias. % Inputs are INDATA, vector containing the ecg signal, % and SR, sampling rate of indata (in Hz). % Output is ALARM, a vector of zeros/ones indicating time frames % when alarm is inactive/active. % Make sure that indata is a column vector indata = indata(:); % Initialize variables outside the loop . . . frlen = 10 * SR; % length of each data frame, 10 sec at SR Hz hop = frlen/2; % amount to advance for next data frame ndat = length(indata); % length of input vector outlen = (ndat-(frlen-hop))/hop;% length of output vector = total frames alarm = zeros(outlen,1); % initialize output signal to all zeros % Here's the loop --- Each iteration processes one frame of data . . . for i = 1:outlen % Get the next segment seg = indata(((i-1)*hop+1):((i-1)*hop+frlen)); % Perform computations on the segment . . . % Decide whether or not to set alarm . . . if something or other . . . alarm(i) = 1; end end %end for loop