Code for elements in equation to create a matrix

2 ビュー (過去 30 日間)
lo
lo 2014 年 3 月 16 日
回答済み: Muhammad Tabish Bilal 2021 年 4 月 22 日
D is a 1x3 matrix
f is a 3x3 matrix
I want to create a matrix of A by the following equation:
for j=1:3
for i=1:3
A(i)=(sum(D(j).*f(i,j)))^-1;
end
end
But it turns out that the answer is wrong
What should be the correct code of this equation?

採用された回答

Mischa Kim
Mischa Kim 2014 年 3 月 16 日
Lo, no need to use loops:
A = 1./(f*D)
Make sure that D is a column vector.
  1 件のコメント
lo
lo 2014 年 3 月 18 日
編集済み: lo 2014 年 3 月 18 日
how about if I want to get this equation
using the answer of A?
O is a 1x3 or 3x1 matrix

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

その他の回答 (1 件)

Muhammad Tabish Bilal
Muhammad Tabish Bilal 2021 年 4 月 22 日
for counter1= 1: 13 % counter for the rows of intended matrices
for counter2= 1 : 13 % counter for coloumns of intended matrices
SMO(counter1,counter2) = counter1+counter2; % here you may use the equation you want to drive a matrices from but keep in mind it should be a column matrices using the same counter of inner loop
end
end

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by