How can I make a differential matrics?

1 回表示 (過去 30 日間)
som
som 2011 年 12 月 27 日
Hi all
I have three matrices which obtained from a series of caculations. these matrices are cumulative i.e. values of matrix 2 are equal to ' values of matrix 1 + other values'. also values of matrix 3 are equal to ' values of matrix 2 + other values'. I want to make two matrices including differences between matrices 3 and 2 as well as matrices 2 and 1.It is necessary that all elements of these two matrics are aqual to a single value. How can I write this program? Thanks

採用された回答

Andrei Bobrov
Andrei Bobrov 2011 年 12 月 27 日
1) A,B,C - your matrix
Mx = cat(3,A,B,C);
Out = diff(Mx,1,3);
a = unique(Out);
2) The inverse problem
A - the initial matrix;
b - a scalar, which add to each element of the matrix;
out = bsxfun(@plus,A,b*reshape(0:2,1,1,[]));
  2 件のコメント
som
som 2011 年 12 月 27 日
Hi andrei
Could you please explain your answer a bit more??
Thanks
Andrei Bobrov
Andrei Bobrov 2011 年 12 月 27 日
'Out' - two matrices including differences between matrices 1 and 2 as well as matrices 2 and 3;
a - value of elements of matrices 'Out'.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by