MATLAB: Could anyone help to covert the equation into matlab code

codeequationequation into code

How to convert this into code?

Best Answer

Not sure what arrays p and g should be.
B=sum(log(1+(p(2:n).*g(2:n))./(1+arrayfun(@(x)sum(x*g(3:n)),p(2:n))))/log(2));