fork download
  1. f = @(x)sum(conv(x,1:3>0,'same'))
  2.  
  3. f([1,2,3,4,5])
Success #stdin #stdout 0.22s 103360KB
stdin
Standard input is empty
stdout
f =

@(x) sum (conv (x, 1:3 > 0, 'same'))

ans =  39