Every two elements mean between these two element

Palindrom

I am a newbie for Matlab. I try to take every two consecutive elements' means and put it between these two consecutive elements. For example; If I have a vector like below:

  a=[1 2 5 4 3 6]

At the end I need b like:

b=[1 1.5 2 3.5 5 4.5 4 3.5 3 4.5 6] 

It can be done via loops but I try to do via matlab function is it possible to do ?

Shai

The "brute force way":

b = zeros( 1, 2*numel(a)-1 );
b(1:2:end) = a; % take care of the original values
b(2:2:end) = 0.5*( a(1:end-1) + a(2:end) ); % the mean

Using interp1:

b = interp1( 1:2:(2*numel(a)-1), a, 1:(2*numel(a)-1), 'linear' )

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

mean of non zero elements - why are these two attempt returning different results?

분류에서Dev

How to create every combination possible between two array of objects?

분류에서Dev

Finding common elements between two arrays without any loop

분류에서Dev

Get closest element between two dataframes - multiple conditions

분류에서Dev

How to removes all the elements between the two elements that I select in linked list

분류에서Dev

Two onclick on one element

분류에서Dev

xcorr between two matrices

분류에서Dev

association between two models

분류에서Dev

Sort the element content (serno) when it is grouped by other two elements (surname, firstname)

분류에서Dev

Gap Between two two dates of different cells

분류에서Dev

synchronized hover of two different elements

분류에서Dev

Insert Hyphon Every Two Characters Batch

분류에서Dev

group element by two python list

분류에서Dev

QGraphicsPathItem between two movable QGraphicsRectItem

분류에서Dev

Angle between two vectors matlab

분류에서Dev

mirroring a pane between two windows

분류에서Dev

Exponential probability between two numbers?

분류에서Dev

Difference in years between two dates

분류에서Dev

Checking if time is between two intervals

분류에서Dev

Distance Between Two Geo Coordinates

분류에서Dev

Center div between two divs

분류에서Dev

How to compare two object elements in a mongodb array

분류에서Dev

Adding two elements side by side, responsive

분류에서Dev

matching and extracting elements with two data frames

분류에서Dev

How to compare elements of two input lists?

분류에서Dev

Keeping two elements inline on responsive display

분류에서Dev

Grouping elements by two fields on a space delimited file

분류에서Dev

Algorithm for comparisons of elements in a two dimensional array

분류에서Dev

Compare two arrays and print number of matching elements

Related 관련 기사

  1. 1

    mean of non zero elements - why are these two attempt returning different results?

  2. 2

    How to create every combination possible between two array of objects?

  3. 3

    Finding common elements between two arrays without any loop

  4. 4

    Get closest element between two dataframes - multiple conditions

  5. 5

    How to removes all the elements between the two elements that I select in linked list

  6. 6

    Two onclick on one element

  7. 7

    xcorr between two matrices

  8. 8

    association between two models

  9. 9

    Sort the element content (serno) when it is grouped by other two elements (surname, firstname)

  10. 10

    Gap Between two two dates of different cells

  11. 11

    synchronized hover of two different elements

  12. 12

    Insert Hyphon Every Two Characters Batch

  13. 13

    group element by two python list

  14. 14

    QGraphicsPathItem between two movable QGraphicsRectItem

  15. 15

    Angle between two vectors matlab

  16. 16

    mirroring a pane between two windows

  17. 17

    Exponential probability between two numbers?

  18. 18

    Difference in years between two dates

  19. 19

    Checking if time is between two intervals

  20. 20

    Distance Between Two Geo Coordinates

  21. 21

    Center div between two divs

  22. 22

    How to compare two object elements in a mongodb array

  23. 23

    Adding two elements side by side, responsive

  24. 24

    matching and extracting elements with two data frames

  25. 25

    How to compare elements of two input lists?

  26. 26

    Keeping two elements inline on responsive display

  27. 27

    Grouping elements by two fields on a space delimited file

  28. 28

    Algorithm for comparisons of elements in a two dimensional array

  29. 29

    Compare two arrays and print number of matching elements

뜨겁다태그

보관