# Thread: Matlab ( Matrix )

1. ## Matlab ( Matrix )

Hello
i have 3 variables w,r,d as shown in the attached file (number 1)
i tried to put the vaules of all variables in a single Matrix (y) as shown in the attached file (number 2) but i could not
my result was like this
y= w1 r1 d1
y= w2 r2 d2
y= w3 r3 d3

my goal is to have a matrix (y) as shown in the attached file (number 3) as a form of
y=
w1 r1 d1
w2 r2 d2
w3 r3 d3
then find the value of y(2,2) which is r2 =0.5000 + 0.8660i

the code of number (1) is:

n=2;
for k=0:n
w=exp((2*pi*k*j)/(n+1))
r=w+1
d=r/w
end

thank you

2. Originally Posted by Zamorano
Hello
i have 3 variables w,r,d as shown in the attached file (number 1)
i tried to put the vaules of all variables in a single Matrix (y) as shown in the attached file (number 2) but i could not
my result was like this
y= w1 r1 d1
y= w2 r2 d2
y= w3 r3 d3

my goal is to have a matrix (y) as shown in the attached file (number 3) as a form of
y=
w1 r1 d1
w2 r2 d2
w3 r3 d3
then find the value of y(2,2) which is r2 =0.5000 + 0.8660i

the code of number (1) is:

n=2;
for k=0:n
w=exp((2*pi*k*j)/(n+1))
r=w+1
d=r/w
end

thank you
Code:
n=2;
xx=[];
for k=0:n
w=exp((2*pi*k*j)/(n+1));
r=w+1;
d=r/w;
xx=[xx;[w,r,d]];
end

xx
CB

3. thank you very much CB