selecting mid points

13 views (last 30 days)
kash
kash on 7 Jan 2012
I have a values
F=[3 5 6 15 17 21 35 45 46 51 56 57 66 70 71 ]
now i want to calculate the mid points that is
i have to take 2 values that is(3,5)and (5,6) cal mid point(4,5.5)
next (5,6),(6,15) mid point is(5.5,10.5)
(6,15)and(15,17) mid point(10.5,16)
(15,17)and(17,21) mid point is(16,19)
and so on
please help

Accepted Answer

Image Analyst
Image Analyst on 7 Jan 2012
Use convolution (a sliding window filter), conv():
F=[3 5 6 15 17 21 35 45 46 51 56 57 66 70 71 ]
F_mid = conv(F, [0.5 0.5], 'valid')
Results:
F =
3 5 6 15 17 21 35 45 46 51 56 57 66 70 71
f_mid =
Columns 1 through 12
4.0000 5.5000 10.5000 16.0000 19.0000 28.0000 40.0000 45.5000 48.5000 53.5000 56.5000 61.5000
Columns 13 through 14
68.0000 70.5000
  1 Comment
kash
kash on 7 Jan 2012
Thanks a lot now can u please tell how to combine as
4,5.5
5.5,10.5
10.5,16
so on

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!