how to sum two dimensional variables? and store in a single dimensional variable?
2 次查看(过去 30 天)
显示 更早的评论
R=3;
M=[2,4,8];
beta=8;
pa=9;
pb=7.2;
po=0:0.5:12;
for kk=1:length(M)
for ii=1:length(po)
ko(ii)=floor(po(ii)*M(kk)/pa);
psearch=union([0,pb],(M(kk)*po(ii)/(ko(ii)+1)));
for i=1:1:length(psearch)
pp=(M(kk)*po(ii)-psearch(i))/ko(ii);
f(i)=(1-exp(-((2^R-1)/psearch(i))^(beta/2)))+ko(ii)*(1-exp(-((2^R-1)/pp)^(beta/2)));
end
po_cap=min(f);
if po(ii)>=pa
for i=1:M(kk)
p1i(ii,i)=po(ii);
end
end
if po(ii)< pa
for i=1:M(kk)-ko(ii)-1
p2i(ii,i)=0;
end
for i=M(kk)-ko(ii)
p3i(ii,i)=po_cap;
end
for i=M(kk)-ko(ii)+1:M(kk)
p4i(ii,i)=(M(kk)*po(ii)-po_cap)/ko(ii);
end
end
end
end
I need to sum p1i,p2i,p3i,p4i and store in a variable s1power..how can be done?..can someone
suggest a solution?
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!