フィルターのクリア

Finding the slope of two consecutive numbers in a matrix

1 回表示 (過去 30 日間)
Islam
Islam 2013 年 11 月 28 日
コメント済み: Islam 2013 年 11 月 29 日
say I have this matrix (j,w)= (3,4)
A =
[ 8 10 2 20
2 4 5 10
3 5 0 4]
I want to find the slope between each two consecutive elements in the matrix and save the result in a different matrix B
e.g
B=
[ f(10)-f(8)/10-8 , f(2)-f(10)/10-2 , f(20)-f(2)/20-2
f(4)-f(2)/4-2 , f(5)-f(4)/5-4 , f(10)-f(5)/10-5
f(5)-f(3)/5-3 , f(0)-f(5)/0-5 , f(4)-f(0)/4-0 ]
f is the sqrt of the number.
I found the gradient function but I am not sure how to use it ..

採用された回答

Image Analyst
Image Analyst 2013 年 11 月 28 日
Does this work:
A =...
[ 8 10 2 20
2 4 5 10
3 5 0 4]
squareRootA = A .^ 0.5
num = diff(squareRootA, 1, 2)
den = diff(A, 1, 2)
results = num ./ den
  2 件のコメント
Image Analyst
Image Analyst 2013 年 11 月 28 日
By the way, it's not the slope. I don't know what it is but I know it's not the slope.
Islam
Islam 2013 年 11 月 29 日
yes, I figured later.
Thanks a lot, that helped much

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by