From: Marko Mijatovic on
I have a pseudo code, only I dont know how to write this part in MATLAB
for i from 1 to n
-----> this part is most important
A xi = ei (x1 should be added in the first column of the matrix A ^ -1, and e1 = [1 0 0 .....] etc. ..
I am interested in how to put that 1 is the i-site in the vector ei)

ie I am interested in how to generate ei with loop (e1, e2, e3, e4, e5 ,......)
do you now understand what I need............
From: Andy on
> ie I am interested in how to generate ei with loop (e1, e2, e3, e4, e5 ,......)
> do you now understand what I need............

for i=1:n
ei=zeros(1,n);
ei(i)=1;
% etc.
end

Or, if you want to keep the ei around (rather than overwriting one variable called ei):

e=eye(n);
for i=1:n
% note: ei=e(i,:)
% etc.
end
From: Marko Mijatovic on
"Andy " <theorigamist(a)gmail.com> wrote in message <hinopa$f4q$1(a)fred.mathworks.com>...
> > ie I am interested in how to generate ei with loop (e1, e2, e3, e4, e5 ,......)
> > do you now understand what I need............
>
> for i=1:n
> ei=zeros(1,n);
> ei(i)=1;
> % etc.
> end
>
> Or, if you want to keep the ei around (rather than overwriting one variable called ei):
>
> e=eye(n);
> for i=1:n
> % note: ei=e(i,:)
> % etc.
> end


thank you......