how to create a 1xn matrix from a loop

sir, my problem is i want to assign power values to 50 nodes.i m initializing first node power value as 1000.i have written the code like below.
p1=1000; for j=2:k pj=p1+j*100; j=j+1; end
here i have taken k as total no of nodes.j is the node no.i.e, traversing from first node to kth node.pj expression i have taken on my own to assign different values to different nodes.my problem is i m getting the result as a single value and i want to express it in a 1xn matrix form.i m new to matlab.its urgent for doing my project.pllllzzz help me..i want a urgent reply. Expecting a favorable reply. Thanking u SUCHI.

댓글 수: 1

Walter Roberson
Walter Roberson 2011년 5월 14일
What is your intention when you try to modify j within the "for" loop that is running over the variable j ? Are you trying to proceed by 2's for example?

댓글을 달려면 로그인하십시오.

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2011년 5월 14일

1 개 추천

so?(EDIT)
p1 = 1000;
k = 50;
p = p1 + 100*(0:49)
or
p=linspace(1000,6000,50)
or your variant
p(1) = 1000;
for j = 2:k
p(j) = p(1) + j*100;
end

댓글 수: 2

suchismita
suchismita 2011년 5월 16일
thank u sir.its really helped me.
suchismita
suchismita 2011년 5월 19일
sir my problem is i want to assign effective bit rate values to each of 50 mobile nodes attached with 5 access points in a WLAN area and 2 base stations in a cellular coverage region respectively.i tried the expression below.
e11=54*10^6; eij = e11 + 10*(0:49);
e111_c=108*10^6; ei1j_c = e111_c+ 10*(0:49); i initialized a constant value 54*10^6 bits per second for access points and 108*10^6 bps for base stations.i want to vary it 10 bits to get all the bit rates.by trying the above expression i m getting a single row and 50 columns.But my requirement is to get it in 50 columns& 5 rows form for mobile nodes attached to access points and 50 columns& 2 rows form for mobile nodes attached to base stations.plllzzz help. sir, Is there any other method or formula to get effective bit rate values of each of mobile nodes attached to access points in a WLAN area and base stations in a cellular coverage region respectively.if yes then plzzz reply soonn..PLLLZZZ HELLPP. Expecting a favorable reply. Thanking u SUCHI.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by