how can i define a piecewise function in matlab

Réponses (1)

Use logical indexing, for this case, you don't even need to apply the logical indices:
h = ~(x-w/2 <= d & d <= x+w/2);

Catégories

En savoir plus sur Entering Commands 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