The summation is across ‘f(x,y)’, not only ‘y’, so the function must work for all values of the arguments. The only way to do this is to create both arguments as matrices, since the multiplication will only work for matrices of the same size, then sum across the ‘y’ matrix.
N = 50;
x = linspace(0, 10*pi, 250);
[X,Y] = ndgrid(x, (1:N));
fxy = @(x,y) sum(2*y.*sin(x),2);
fx = @(x) fxy(x,Y);
The summation is across the rows because that is how the ndgrid function creates the matrices, as I have defined them here.
Even if this is homework, the approach would not be obvious for someone with little experience in these sorts of MATLAB calculations.