Matlab - Création du fichier .m d'une fonction définie par morceaux

Soit la fonction y = f(x) :

Le fichier f5.m associé à cette fonction s'écrit :

 

>> f5 (0)

ans =

0

>> f5 (1)

ans =

0.5000

>>f5 (-10)

ans =

0

>> f5 (3)

ans =

0.0556

>> fplot ( 'f5' , [ -2 4 ] )

>> grid on

 

© Fabrice Sincère

http://perso.orange.fr/fabrice.sincere/