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?

 Réponse acceptée

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 commentaire

esmail chogoli
esmail chogoli le 1 Jan 2016
Modifié(e) : esmail chogoli le 1 Jan 2016
thank you for your answer.but when i want to write this code in matlab give me an error for mask

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Simulink Design Optimization dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by