function f = emaHybrid(x,alpha,beta)
% calculate hybrid exponential moving average
% alpha: ema decay, beta: pretictive weight
n =length(x);
b = (alpha*ones(1,n)).^(1:n);
b = b(b>0.05); % limit FIR to 5%
b = b/sum(b);

ema = filter(b,1,x);
pred = filter([2 -1],1,x);
f = beta*pred+(1-beta)*ema;

f(1:length(b))=nan;