フィルターのクリア

Error between each pixel for two matrices of equal size

2 ビュー (過去 30 日間)
Lily
Lily 2012 年 10 月 5 日
Hi
I'm trying to find the error between to matrices of equal size. Let's say that my matrices are of size 4x4 :
A = [0 1 0 0; 1 1 0 0; 0 1 0 1; 0 1 1 0];
B = rand(4,4);
How would you find the error between each pixel of those matrices?
  2 件のコメント
Thomas
Thomas 2012 年 10 月 5 日
編集済み: Thomas 2012 年 10 月 5 日
What do you mean by error? Is the difference between each corresponding value?
Lily
Lily 2012 年 10 月 5 日
Yes, I was going for the error that is the difference between each corresponding value :) Sorry for not making my question more clearly.

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

採用された回答

Image Analyst
Image Analyst 2012 年 10 月 5 日
Wouldn't it just be
theError = A - B;
Caution: don't use error for the variable name since that is the name of a built-in MATLAB function.

その他の回答 (1 件)

Thomas
Thomas 2012 年 10 月 5 日
Is this what you want
A = [0 1 0 0; 1 1 0 0; 0 1 0 1; 0 1 1 0];
A =
0 1.00 0 0
1.00 1.00 0 0
0 1.00 0 1.00
0 1.00 1.00 0
B = rand(4,4)
B =
0.62 0.59 0.76 0.08
0.47 0.55 0.75 0.05
0.35 0.92 0.38 0.53
0.83 0.29 0.57 0.78
>> out = A - B
out =
-0.62 0.41 -0.76 -0.08
0.53 0.45 -0.75 -0.05
-0.35 0.08 -0.38 0.47
-0.83 0.71 0.43 -0.78

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by