フィルターのクリア

How to sum multiple matrices?

29 ビュー (過去 30 日間)
Sahar abdalah
Sahar abdalah 2015 年 4 月 11 日
コメント済み: Sahar abdalah 2015 年 4 月 11 日
Hello, I 'm new in matlab and I need help please. I have 3 matrix A,B et C. the size of each matrix is 1000*1121. I want to sum the 3 matrix (A+B+C) and save the result in a matrix D (for example : D[1,1]= A[1,1]+B[1,1]+C[1,1]). Please, how can I implement this problem in matlab? and thanks in advance

採用された回答

pfb
pfb 2015 年 4 月 11 日
Product of matrices is "*". Therefore, if they're the same size, D= A*B*C; If instead you want elementwise product, D = A.*B.*C; But all of this is very basic, and explained in the documentation.
  1 件のコメント
Sahar abdalah
Sahar abdalah 2015 年 4 月 11 日
thanks

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

その他の回答 (1 件)

pfb
pfb 2015 年 4 月 11 日
編集済み: pfb 2015 年 4 月 11 日
Hi
have you tried the following?
D = A+B+C;
I'm not sure what you mean with the square parentheses. In matlab square parentheses are used to define vectors and matrices, as in
v = [1 2 3];
or
M = [1 2; 3 4];
not to access matrix elements. Matrix elements are accessed with A(1,3). Anyway sum and subtraction can be used to sum entire matrices, provided that they have the same sizes.
  1 件のコメント
Sahar abdalah
Sahar abdalah 2015 年 4 月 11 日
thank you it works for the sum but you have an idea how to make the product of these three matrices?

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

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by