Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to write these expression, where r_ij are the elements of any arbitrary matrix of even order?

1 回表示 (過去 30 日間)
Farooq Aamir
Farooq Aamir 2018 年 4 月 23 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日

回答 (1 件)

Farooq Aamir
Farooq Aamir 2018 年 5 月 2 日
I have written above inequalities, is there any shorter to write these?
R=[1, 2, 3, 5;4, 8, 9, 6 ; 5, 6, 7,8;1,1,1,1]; n=length®;
s1 = 0.0;
for j=1:n
a1=R(1,j)^2;
s1=s1+a1;
d1=sqrt(s1);
end
s2=0.0;
for j=1:n
a2 = R(2,j)^2;
s2=s2+a2;
d2=sqrt(s2);
end
if (d2<=d1)
b1=d2;
else
b1=d1;
end
s3=0.0;
for j=1:n
a3 = R(3,j)^2;
s3=s3+a3;
d3=sqrt(s3);
end
if (d3<=d2)
b2=d3;
else
b2=d2;
end
s4=0.0;
for j=1:n
a4 = R(4,j)^2;
s4=s4+a4;
d4=sqrt(s4);
end
if (d4<=d3)
b3=d4;
else
b3=d3;
end
s5=0.0;
for j=1:n
a5 = R(5,j)^2;
s5=s5+a5;
d5=sqrt(s5);
end
if (d5<=d4)
b4=d5;
else
b4=d4;
end
D=blkdiag(d1,b1,b2,b3,b4);

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by