Matlab - Création du fichier .m d'une fonction
définie par morceaux
Exemple :
Soit la fonction y = f(x)
:Le fichier f5.m associé à cette fonction s'écrit :
>> f5 (0)
ans =
0
>> f5 (1)
Page 1 sur 2 Matlab- Fonction définie par morceaux 00105/11/2008 http://pagesperso-orange.fr/fabrice.sincere/matlab/matlab_fonction_par_morceaux.htm
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/ Page 2 sur 2 Matlab- Fonction définie par morceaux 00105/11/2008 http://pagesperso-orange.fr/fabrice.sincere/matlab/matlab_fonction_par_morceaux.htm