MATLAB: How to write the following function in Matlab

help me

please help me. i want this function to solve following optimization problem. can you help me?

Best Answer

function r = rho(r,c)
r = c^2/6 .* ones(size(r));
mask = abs(r) <= c;
r(mask) = c^2/6 .* (1 - (1 - r(mask)./c).^2).^3);