MATLAB: How to solve Error using max Too many input arguments

too many input arguments

cs1(i)=(1/2)*log2(1+(gsd(i)+max(grd1(i),grd2(i),grd3(i),grd4(i))));

Best Answer

max() can take at most two arguments to apply the maximum function. If you want to find maximum value among four values, pass them like a vector
max([grd1(i),grd2(i),grd3(i),grd4(i)])