How can I write the following function in Matlab?

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

 Accepted 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);

1 Comment

thank you for your answer.but when i want to write this code in matlab give me an error for mask

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink Design Optimization in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!