help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:element extraction from vector


From: hassen ben Thabet
Subject: Re:element extraction from vector
Date: Fri, 8 Jan 2010 21:46:56 +0100

My discussion concerns some handling of a large number of columns of a matrix. In fact, I have a matrix A of size (100,20000). Each column of A is composed of -1, 0 and 1. Each passages from -1 to 1 define an expansion for each column. The duration of each expansion is the subtraction of the index of 1 that of (-1) (Obviously, the involving elements 1 and -1 in this expansion). Similarly, each passage from 1 to -1 defines a recession, for each column.
The duration of each recession is the subtraction of the index (-1) that of 1. I would say by the index, the number of observation in the column.
To better clarify, I give the following example:
u is the vector containing 10 observations:
[1 0 0 0 0 -1 0 -1 0 1] '
In this vector u there is a recession: the passage of the first element of the vector (which is 1) to the 6th element (which is -1) and duration of this recession is 6-1 = 5.
In this vector u there is an expansion: the passage of the 8th element which is -1 to the 10th element which is 1. The duration of this expansion is 10-8 = 2.
Is there someone who can help me with a program that can determine, for each column of my matrix A, the different expansions, the different recessions and their durations. In a preceding discussion, Vic has proposed an excellent code doing this task for each column but I would like to obtain the results in a whole matrix for the total number of columns (20000).
Many thanks in advance.
Hassen.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]