[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
need some help with vectorization
From: |
Miĥail Vasiljev |
Subject: |
need some help with vectorization |
Date: |
Tue, 25 May 2010 11:00:51 +0400 |
Hello!
One more question. I use fsolve to solve the system of nonlinear
equations. To do this I need to form a vector y of equations, just as
described in Octave manual. The problem is, to form the vector I need
to take some data from the M by N matrix, there M*N == number of
equations. In particular, I need to take the middle of the matrix,
i.e. all the elements, except for that from the first and the last
column and the first and the last row. Is there any way to do so in a
vectorised way? For example, I need to do something like this:
M = [ 1, 2, 3, 4;
5, 6, 7, 8;
9, 1, 2, 3;
4, 5, 6, 7]
The part of the matrix I need is [6,7;1,2] here.
y(1:16) = 1; #make's no sense, just for example
So, here I need a vectored way to do something like:
y(6) = M(2, 2)
y(7) = M(2, 3)
y(10) = M(3, 2)
y(11) = M(3, 3)
P.S. Sorry for my English, that's not my native language, and I try to
describe the problem as clear as possible.
Thank you!
--
Miĥail Vasiljev <address@hidden>
- need some help with vectorization,
Miĥail Vasiljev <=