How to do the calculation of these three different size matrices ?

 採用された回答

Amritesh
Amritesh 2022 年 6 月 28 日
編集済み: Amritesh 2022 年 6 月 28 日

0 投票

First we have to create and initialise the arrays
C = [100,150];
B = [1,1;0.923077,0.615385;1,1;1,1;1,1];
D1 = [0,1,1,0,0,1.923077,3389.76;0,0,1,0,1,2,1793;0,1,1,0,0,1.923077,3389.76;0,0,1,0,1,2,1793];
D2 = [1,1,0,0,0,1.615385,5538.952;1,1,0,0,0,1.615385,5538.952;1,0,0,1,0,2,3601;1,0,0,1,0,2,3601];
A(:,:,1) = D1;
A(:,:,2) = D2;
Now,
F2 in first row of second column of D1 will correspond to A(1,2,1). So,
F2 = B[F2,C1]*C[D1]/A[1,6,D1] will be equivalent to
A(1,2,1) = B(2,1)*C(1)/A(1,6,1)
Similarly, you can calculate for other cells.
Hope this solves your issue.

5 件のコメント

Akash Pal
Akash Pal 2022 年 6 月 28 日
Yes ,It's only for the permanant value ,but i was trying to solve for the random values so that time I need to again change my all values manually .I want that it will be automatically calculated for the any value ,I dont need to give the everytime matrix position by myself
Amritesh
Amritesh 2022 年 6 月 28 日
編集済み: Amritesh 2022 年 6 月 28 日
You can use nested loop like below for updating values
for k = 1:2
for i = 1:4
for j =1:5
A(i,j,k) = B(j,k)*C(k)/A(i,6,k);
end
end
end
Hope this solves your problem.
Akash Pal
Akash Pal 2022 年 6 月 28 日
But where you have used the value od D1 and D2 matrix I mean the value of A(:,:,1) and the value of A(:,:,2)
Amritesh
Amritesh 2022 年 6 月 28 日
編集済み: Amritesh 2022 年 6 月 28 日
Here, k = 1 signify D1 and k = 2 signify D2.
Just try dry run of loop using pen and paper.
You can accept the answer if you understood.
Akash Pal
Akash Pal 2022 年 6 月 28 日
Thank you .i understand it

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

製品

質問済み:

2022 年 6 月 28 日

編集済み:

2022 年 6 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by