How to make a function defined at discrete points?

 Réponse acceptée

One possibility:
xn = @(n) [(n==0) (n==1) (n==2) (n==5) (n==6)]*[1; 2; 3; 2; 2];
y = xn(2)
y =
3

Plus de réponses (0)

Catégories

En savoir plus sur Interactions, Camera Views, and Lighting dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by