How to make a function defined at discrete points?

 Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Interactions, Camera Views, and Lighting in Centro assistenza e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by