MATLAB: How to make the dimensions agree for this function

MATLABmatrix

f = @(x) x – exp(cos(transpose[1:4])*sum(x)); And x=[2.5;2;1.4;.9] is a column vector. when I subtract it says error Matrix dimensions must agree.

Best Answer

f = @(x) x.' - exp(cos([1:4]*sum(x)))
Related Question