Could anyone help me how to consider the rows of matrix part by part.

1 次查看(过去 30 天)
Code:
B = partitions(2);
G=rand(4,1);
P=rand(4,1);
for d=1:length(B)
for e=1:length(B{d})
for v =1:size(P,2)
for u =1:size(G,1)
Z(u,v) =(300.*log2(1+(((G(u,v)).*(P(u,v))/(0.5+sum(P(1:u-1,v)).*G(u,v))))))
end
end
end
end
In this code, B has two different types of partitions
For first partition {1 2}, I need to take first rows from G and P to calculate Z.
For second partition {1} {2}, I need to take third and fourth row from G and P to calculate Z.
But when I run the code it takes all the rows for G and P for each partition.
Could anyone help me how to take only first two rows for {1 2} and the next two rows for {1} {2}.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by