MATLAB: Converting an equation into MATLAB code

equationformulaneural networksmape

I am trying to write a code that calculates the accuracy of my network using sMAPE. The equation is depicted here:
(Y is actual value, F is forecast value, n is the amount of data)
I have written this code (I have 25 data):
e= gsubtract(output,y);
y= net(input);
accuracy = (0.08*mean(abs(e./(abs((output)+(y))))))
"output" on the code above is the target, "y" is the output (sorry for the misleading name with the actual output) Assuming I use the equation above as a reference, is this code correct?

Best Answer

sMAPE = sum(abs(Y - F) ./ abs(Y + F)) * (2/length(Y))