Sign in

username:

password:



Not a member?

Search matlab



Search tips

Subscribe to matlab



matlab by Keywords

Atanh | Autocorrelation | Bandpass Filter | C++ | Conv | Database | Deconv | Excel | FFT | Filter | Filtering | FIR | Fourier Transfrom | FSK | Gaussian Noise | Haykin | IFFT | Image | Java | LFSR | LMS | LPC | MEX | OFDM | QPSK | Radix | Random | Sampling | Segmentation | Simulink | Visual Basic | Waveform | Wavelet


Discussion Groups

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | Matlab DSP | Framing and overlapping of data sequences

Technical discussion about Matlab and issues related to Digital Signal Processing.

  

Post a new Thread

Framing and overlapping of data sequences - Author Unknown - Dec 4 6:15:00 2001

Hi. I hope there's someone who can help me with this. I am relatively
new to DSP and Matlab.

I have a data sequence (essentially obtained by wavread from a speech
wav file). What I need to do now is to block the data into frames of
30ms long, and then overlap them (20ms of overlap).

Does anyone have any suggestion on how I should approach this?



______________________________
Start your Android Ice Cream Sandwich development on TI's AM35x Sitara ARM Cortex-A8 processor today.



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re: Framing and overlapping of data sequences - Joe Sababa - Dec 4 22:25:00 2001


--- wrote:
> Hi. I hope there's someone who can help me with
> this. I am relatively
> new to DSP and Matlab.
>
> I have a data sequence (essentially obtained by
> wavread from a speech
> wav file). What I need to do now is to block the
> data into frames of
> 30ms long, and then overlap them (20ms of overlap).
>
> Does anyone have any suggestion on how I should
> approach this? >
Hi,
It seems that your problem is asimple one althohgh it
frased in acomplicated way. I assume you havs a long
sequence of data that you want to cut into equally
long segments and than show it on a graph with some
given overlap.
Suppose the total number of data points is N and each
segment is n long. The segmentation is done by:
Mseg=reshape(Data,n,floor(N/n));
To plot it so that each on is starting k points after
the start of the previous segment you have to make a
loop.
*Code*
X=1:n;
Q=k; % shift
Col=['r','b','g','c','y','m','k'] %colors vector
for k=1:floor(N/n)
K=mod(k,7)+1;
plot(X,Mseg(:,k),'color',Col(K));
hold on
X=X+Q;
end
drawnow
*End*

Joe
BSTEX - Equation viewer for Matlab
http://www.geocities.com/bstex2001

__________________________________________________


______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re: Framing and overlapping of data sequences - Bill Driscoll - Dec 5 15:04:00 2001


If you are using the Signal Processing Toolbox, try using BUFFER. Here is
the help:

>> help buffer

BUFFER Buffer a signal vector into a matrix of data frames.
Y = BUFFER(X,N) partitions signal vector X into nonoverlapping data
segments (frames) of length N. Each data frame occupies one
column in the output matrix, resulting in a matrix with N rows.

Y = BUFFER(X,N,P) specifies an integer value P which controls the amount
of overlap or underlap in the buffered data frames.
- If P>0, there will be P samples of data from the end of one frame
(column) that will be repeated at the start of the next data frame.
- If P<0, the buffering operation will skip P samples of data after each
frame, effectively skipping over data in X, and thus reducing the
buffer "frame rate".
- If empty or omitted, P is assumed to be zero (no overlap or underlap).

Y = BUFFER(X,N,P,OPT) specifies an optional parameter OPT used in the
case of overlap or underlap buffering.
- If P>0 (overlap), OPT specifies an initial condition vector with
length equal to the overlap, P. If empty or omitted, the initial
condition is assumed to be zeros(P,1). Alternatively, OPT can be
set to 'nodelay' which removes initial conditions from the output and
starts buffering at the first data sample in X.
- If P<0 (underlap), OPT specifies a scalar offset indicating the number
of initial data samples in X to skip. The offset must be in the range
[0, -P], where P<0. If empty or omitted, the offset is zero.

Y = BUFFER(X, ...) returns a matrix of data frames, one frame per
column. If X does not contain a multiple of (N-P) samples, zeros
will be appended to the last frame as needed.

[Y,Z] = BUFFER(X, ...) forces Y to contain only complete frames of data,
and returns any remaining samples (i.e., a partial frame) in vector Z.
The orientation of vector Z will be the same as X. Z will be an empty
vector if the length of X is a multiple of (N-P).

[Y,Z,OPT] = BUFFER(X, ...) returns an options argument OPT which can
be used in the next call to BUFFER, and is primarily intended for use
in continuous buffering applications. EXAMPLE: Buffering with overlap.
Buffer an entire signal vector into 8-sample frames,
each frame overlapping the previous one by 4 samples.

x = 1:18; % Example input data to be buffered
y = buffer(x, 8, 4); % Create overlapping buffer matrix

EXAMPLE: Buffering with underlap.
Buffer an entire signal vector into 8-sample frames,
skipping 4 samples between frames. Return any partial
buffer separately.

x = 1:40; % Example input data to be buffered
[y,z] = buffer(x, 8, -4); % Return last partial frame in z HTH,
Bill D. Joe Sababa

<joesababa@ya To: ,

hoo.com> cc:

Subject: Re: [matlab] Framing and
overlapping of data sequences
12/04/2001

04:25 PM

--- wrote:
> Hi. I hope there's someone who can help me with
> this. I am relatively
> new to DSP and Matlab.
>
> I have a data sequence (essentially obtained by
> wavread from a speech
> wav file). What I need to do now is to block the
> data into frames of
> 30ms long, and then overlap them (20ms of overlap).
>
> Does anyone have any suggestion on how I should
> approach this? >
Hi,
It seems that your problem is asimple one althohgh it
frased in acomplicated way. I assume you havs a long
sequence of data that you want to cut into equally
long segments and than show it on a graph with some
given overlap.
Suppose the total number of data points is N and each
segment is n long. The segmentation is done by:
Mseg=reshape(Data,n,floor(N/n));
To plot it so that each on is starting k points after
the start of the previous segment you have to make a
loop.
*Code*
X=1:n;
Q=k; % shift
Col=['r','b','g','c','y','m','k'] %colors vector
for k=1:floor(N/n)
K=mod(k,7)+1;
plot(X,Mseg(:,k),'color',Col(K));
hold on
X=X+Q;
end
drawnow
*End*

Joe
BSTEX - Equation viewer for Matlab
http://www.geocities.com/bstex2001

__________________________________________________
_____________________________________
/groups.php3



______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )