edited-error in calculating mid point

Sorry my matrix is
28 45781 5 0 0 13
31 77516 7 0 0 16
37 83311 9 0 0 40
in my previous post i did not edit give the matrix form correctly
please help

1 件のコメント

Walter Roberson
Walter Roberson 2012 年 1 月 11 日
Duplicate is at http://www.mathworks.com/matlabcentral/answers/25842-error-in-calculating-mid-point

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

 採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 1 月 11 日

0 投票

K = [28 45781 5 0 0 13
31 77516 7 0 0 16
37 83311 9 0 0 40];
F_mid1 = conv2(K,[1 1;1 1]/4,'valid')
OR
F_mid2 = conv2(K,[1 1]/2,'valid')
OR
F_mid3 = conv2(K,[1; 1]/2,'valid')
Choose your variant!

7 件のコメント

kash
kash 2012 年 1 月 11 日
but andrei the midpoint is
29 61648.5 6 0 0 14.5
34 80413.5 8 0 0 28
bur i get different answer as per ur code
kash
kash 2012 年 1 月 11 日
F_mid2 = conv2(K,[1; 1]/2,'valid')
i get answer as per this
but my first value ans is 29.5
i need exact value for future calculation
kash
kash 2012 年 1 月 11 日
i that i get only 29
kash
kash 2012 年 1 月 11 日
my row sizw will increase i have given matrix for example
Andrei Bobrov
Andrei Bobrov 2012 年 1 月 11 日
Hi Kash! Try this is:
>> format short g;
>> F_mid3 = conv2(K,[1; 1]/2,'valid')
This you need?
kash
kash 2012 年 1 月 11 日
thanks a lot andrei
Walter Roberson
Walter Roberson 2012 年 1 月 11 日
I had proposed that 2 days before in http://www.mathworks.com/matlabcentral/answers/25618-error-using-conv
"If you want 2D convolution, then use a 2D convolution function such as conv2(), probably with [0.5 0.5].' as your kernel"
Notice that [0.5 0.5].' is [0.5; 0.5]

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by