shared-snippets/matlab/unitutils/wavecut.m

23 lines
677 B
Matlab

%
% -----------------
% Copyright © 2022 ACK Cyfronet AGH, Poland.
% -----------------
%
function [wc]=wavecut(wf,startp,endp)
% WAVECUT Extracts a segment of a waveform
%
% [WC] = WAVECUT(WF, STARTP, ENDP) extracts a segment of the waveform WF
% starting at position STARTP and ending at position ENDP. The input
% waveform WF is assumed to be a vector. STARTP and ENDP should be
% numeric values indicating the start and end positions of the desired
% segment.
%
% Example:
% wf = sin(0:0.01:2*pi);
% segment = wavecut(wf, 50, 150);
% plot(segment);
%
% See also: other functions that process waveforms.
wc=wf(round(startp):round(endp));
end