alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Fondamentaux Matlab 2013a
Présentation de la formation
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Présentation du formateur • Informations générales • Fondamentaux • Données • Graphiques • Analyses • Scripting • Conclusion Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
1
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Présentation du formateur • Vincent ISOZ •
[email protected] • Consultant scientifique • Mission conseil, migration et formation • Bsc. Physique • Mes références : Mon profil Alphorm : http://www.alphorm.com/auteur/vincent-isoz
Fondamentaux MATLAB 2013a
alphorm.com™©
Remarques Objectifs (pourquoi cette formation?) Prérequis (matériel et connaissances) Audience (public cible) Références bibliographiques + Liens Internet Hypothèses
IV1
Validation des acquis (certifications) Support post formation Avertissements Et après…? Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
2
Diapositive 4 IV1
On se limite au bases de matlab: donc pas d'usage de Toolbox, ce n'est pas un cours de maths, ni d'ingénierie (ceci est réservé aux cours avancés). C'est juste un cours permettant d'avoir une base solide pour la suite. Évidemment rien de nouveau n'est présenté ici, on trouve déjà tout sur Internet ou sur l'aide en ligne du logiciel ISOZ Vincent; 10/04/2014
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Références bibliographiques
Fondamentaux MATLAB 2013a
alphorm.com™©
Liens • www.google.com • www.youtube.com • www.scribd.com • www.mathworks.com/products/ • www.mathworks.ch/ch/help/matlab/release-notes.html • www.mathworks.com/matlabcentral/fileexchange/ • www.mathworks.ch/discovery/ • www.mathworks.ch/discovery/gallery.html • www.mathworks.com/matlabcentral/newsreader/ Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
3
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Are you read?
alphorm.com™©
Fondamentaux MATLAB 2013a
Informations générales Domaines d'application de Matlab et alternatives
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
4
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Applications 1.
Enseignement scolaire (car le logiciel couvre de large sujets)
2.
Simulations
3.
Traitement du signal
4.
Traitement d'images (et vidéos)
5.
Prototypage rapide (SimuLink)
6.
Finance
7.
Développement d'applications converties en C/C++
8.
Calcul massivement parallèle
9.
…
alphorm.com™©
Fondamentaux MATLAB 2013a
Toolbox 1.
Acquisition du noyau de base (Matlab Home)
• Signal processing Toolbox • Optimization Toolbox
2.
Financial Toolbox
3.
MuPad Toolbox
4.
PDE Toolbox
5.
SimuLink Toolbox
6.
Image Acquisition (video) Toolbox
7.
Matlab Coder Toolbox
8.
Neural Network Toolbox
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
• Database Toolbox • …. www.mathworks.ch/products/
alphorm.com™©
5
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Alternatives gratuites
Octave
Matlab est à l'ingénierie ce que Microsoft Office System est à la bureautique Fondamentaux MATLAB 2013a
alphorm.com™©
En général… Pour chaque Toolbox de Matlab on trouve sur le marché des logiciels spécialisés et souvent plus adaptés à ses besoins (si on cherche bien) mais qui ne couvrent cependant parfois pas un panel aussi large de fonctionnalités que Matlab (qui est très souvent sous-utilisé). Exemples : • MuPAD: Maple • PDE toolbox: COMSOL Multiphysics • Finance toolbox: Gauss Software • Instrument control toolbox: NI LabView • SimuLink: EcosimPro • Mécanique lagrangienne: Mathcad • …. Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
6
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Informations générales Découverte et personnalisation de l'interface
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Démarrer en mode minimum (matlab –nodesktop) • Présentation des différents panneaux/volets • Choix/Enregistrements de layouts • Personnalisation de la barre d'accès rapide • Minimiser les rubans • Personnalisation des rubans?? • Création de raccourcis • Créer sa propre interface?? Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
7
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • La personnalisation de notre environnement dans les limites
d'utilisabilité actuelles du logiciel
alphorm.com™©
Fondamentaux MATLAB 2013a
Informations générales
Commandes systèmes
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
8
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Lancer/Quitter Matlab depuis le shell: !matlab/exit • Afficher la version: version • Afficher les licences: license • Copie dans le presse papier: clipboard • Obtenir l'OS: getenv('OS') • Obtenir la langue de l'environnement: get(0, 'Language') • Obtenir la mémoire disponible: memory • Performance ordinateur: bench • Date du jour: date Fondamentaux MATLAB 2013a
alphorm.com™©
Plan • Date et heure du jour: datestr(now) • Obtenir les variables dans la mémoire: whos • Effacer les variables: clear all • Revenir en haut de fenêtre de commande: home • Effacer le contenu de la fenêtre de commande: clc • Vider l’historique des commandes:
com.mathworks.mlservices.MLCommandHistoryServices.removeAll • Montrer le dossier de travail en cours: pwd • Changer le fichier de démarrage startup.m Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
9
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • L’identification de paramètres systèmes pour maîtriser son
environnement de travail • L’identification de paramètres systèmes pour décider de poursuivre un
script propriétaire ou non
alphorm.com™©
Fondamentaux MATLAB 2013a
Informations générales
Utilisation des aides Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
10
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Ouvrir l'aide: helpwin • Aide sur une commande: help nom_commande • Recherche d'un outil: lookfor nom_outil • Voir le code source d'une commande native avec: edit nom_commande
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Comment devenir autodidacte avec Matlab • Trouver de l'aide même en absence de connexion Internet • Accéder à l’aide de fonctions natives ou créées en interne • Editer certaines commandes système pour les désosser
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
11
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les fondamentaux Gérer les commandes
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
Fondamentaux MATLAB 2013a
alphorm.com™©
Plan • Utiliser le diary: diary(‘…’)/diary off • Commenter ses scripts: % bla bla bla • Écrire des commandes sur plusieurs lignes (finir la ligne avec …) • Sauvegarder/Charger l’espace de travail en cours: save/load • Créer des fichiers scripts *.m et usages y relatifs • Us et coutumes de l'utilisation des commentaires dans les fichiers *.m
(cartouche, versioning, etc.)
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
12
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Utilisation des commentaires pour éviter d’oublier qui a fait quoi et
pourquoi cela a été fait ainsi (en respectant les traditions et les normes)
alphorm.com™©
Fondamentaux MATLAB 2013a
Les fondamentaux Opérations arithmétiques élémentaires Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
13
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Addition, Soustraction, Multiplication , Division: +, -, *, / • Auto-incrémentation: plus(x,1) • Auto-décrémentation: minus(x,1) • Puissance/Racine: (x)^(…) ou sqrt(x) • Valeur absolue: abs(x) • Modulo: mod(x,y) • Reste de la division: rem(x,y)
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Opérations arithmétiques élémentaires telles que vues à la petite école
sur des scalaires…
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
14
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les fondamentaux Opérateurs de comparaisons
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Équivalence: A==B • Strictement plus grand: A>B • Strictement plus petit: A
=B • Plus petit ou égal: A<=B • Différent de: A~=B
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
15
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Comment comparer des éléments que cela soit des nombres (réels ou
complexes) ou des chaînes de caractères
alphorm.com™©
Fondamentaux MATLAB 2013a
Les fondamentaux Manipulation de variables scalaires réelles
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
16
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Plus grand nombre entier positif : intmax • Plus petit nombre entier négative: intmin • Plus grand nombre réel positif à virgule flottante: realmax • Plus petite nombre réel négative à virgule flottant: realmin • Faire des opérations arithmétiques avec des réels • Choisir le niveau de précision: format short, format long, format short e,
format long e,
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Les manipulations classiques par rapport aux nombres réels
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
17
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les fondamentaux Manipulation de nombres complexes Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
Fondamentaux MATLAB 2013a
alphorm.com™©
Plan • Écrire un nombre complexe en utilisant i ou j • Créer un nombre complexe: complex • Obtention du conjugué complexe: conj • Calculer le module d'un nombre complexe: abs • Angle d'Euler du nombre complexe: angle • Partie imaginaire d'un nombre complexe: imag • Partie réelle d'un nombre complexe: real • Déterminer si une variable est complexe ou non: isreal Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
18
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Les manipulations classiques relatives aux nombres complexes
alphorm.com™©
Fondamentaux MATLAB 2013a
Les fondamentaux Arrondis de scalaires (réels ou complexes) Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
19
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Arrondir à l'entier supérieur: ceil • Arrondir à l'entier inférieur: floor • Arrondir à l'entier le plus proche: round • Arrondir à un multiple quelconque sans toolbox
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Les types d’arrondis les plus courants
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
20
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les fondamentaux Opérations ensemblistes
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
Fondamentaux MATLAB 2013a
alphorm.com™©
Plan • Retourner une liste d'unicité d'un vecteur: unique • Union de deux ensembles (vecteurs): union • Intersection de deux ensembles (vecteurs): intersect • Différence exclusive de deux ensembles (vecteurs): setdiff • Contrôle de l'appartenance (vecteurs): ismember • Nettoyer des ensembles (vecteurs) contenant des valeurs vide: isnan • Différence symétrique de deux ensembles (vecteurs): setxor
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
21
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Des opérations ensemblistes très utiles dans certains domaines du Data
Mining et plus généralement dans le domaine de la statistique et de la finance
alphorm.com™©
Fondamentaux MATLAB 2013a
Les fondamentaux Déclaration et manipulation de variables vectorielles
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
22
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Définir un vecteur arbitraire: [….] • Définir un vecteur avec une séquence de nombres: linspace • Dimension d'un vecteur: length, size • Définir un vecteur avec des caractères: {….} • Extraire des éléments d'un vecteur • Sommer/Soustraire des vecteurs: +,• Multiplication/Division composante par composante: ./ , .* • Puissance composante par composante: power, .^ • Calculer la norme euclidienne d'un vecteur: norm Fondamentaux MATLAB 2013a
alphorm.com™©
Plan • Transposée d'un vecteur: transp • Produit cumulé des composantes (probabilités): cumprod • Somme cumulée des composantes: cumsum • Différences par composantes successives: diff • Rang des valeurs d'un vecteur: tiedrank • Calculer le produit scalaire de deux vecteurs: dot • Calculer le produit vectoriel de deux vecteurs: cross • Gradient numérique d'un vecteur: grad • Laplacien numérique d’un vecteur: del2 Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
23
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Nous avons couvert maintenant un des piliers majeurs de Matlab
(Matrix Laboratory) puisque pour rappel un vecteur est un cas particulier d'une matrice et que Matlab est optimisé pour le calcul matriciel • Malheureusement de nombreuses opérations triviales nécessitent
l’achat de Toolbox ou développement de scripts alors que R intégre cela gratuitement • Nous verrons la divergence et la rotationnel lorsque nous traiterons des
graphiques
alphorm.com™©
Fondamentaux MATLAB 2013a
Les fondamentaux Déclaration et manipulation de variables matricielles
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
24
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Définir une matrice arbitraire • Opérations arithmétiques sur matrices +,-,*,/ • Créer rapidement une matrice identité: eye • Dimensions d'une matrice: size(m) • Accéder à une composante donnée d'une matrice • Changer la valeur de certaines composantes d'une matrice • Transposition d'une matrice: trans(m) • Extraire la diagonale d'une matrice: diag(m) • Obtenir la trace d'une matrice: trace(m) Fondamentaux MATLAB 2013a
alphorm.com™©
Plan • Inversion d'une matrice: inv(m) • Rang d'une matrice: rank(m) • Polynôme caractéristique d'une matrice: charpoly • Hessienne d'une matrice: hessian(m) • Exponentation d'une matrice: expm(m) • Matrice jacobienne: jacobian • Valeurs propres d'une matrice: eig • Décomposition en valeurs singulières d'une matrice: svd Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
25
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Nous avons couvert maintenant un des piliers majeurs de Matlab
(Matrix Laboratory) puisque la grande majorité du logiciel est basé sur des algorithmes optimisés pour les manipulations de matrices. • Nous verrons les opérateurs de divergence et de rotationnel qui
s’appliquent sur des matrices lors de graphs pour des raisons pédagogiques
alphorm.com™©
Fondamentaux MATLAB 2013a
Les fondamentaux Travailler avec des tableaux structurés
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
26
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Pourquoi étudier les tableaux structurés?
E1
• Créer un tableau structuré: struct • Obtenir les noms des éléments du tableau structuré: fieldnames • Obtenir les valeurs des éléments: getfields • Mettre à jour des éléments ou créer des éléments dans un tableau
structuré existant • Ordonner les éléments d'un tableau pour faciliter la consultation:
orderfields • Supprimer temporairement ou définitivement des éléments d'un
tableau structuré: rmfield Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Inspiré du principe de R, les tableaux structurés seront probablement de
plus en plus utilisés à l'avenir pour retourner de multiples résultats de calculs dans une structure unique.
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
27
Diapositive 53 E1
De plus en plus de fonction auront comme dans R des résultat renvoyés sous cette forme http://www.mathworks.ch/ch/help/matlab/matlab_prog/create-a-structure-array.html
http://www.mathworks.ch/ch/help/matlab/ref/struct.html Excelsia; 03/06/2014
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les fondamentaux Rappels de quelques fonctions mathématiques Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
Fondamentaux MATLAB 2013a
alphorm.com™©
Plan • Plus grand commun diviseur: gcd • Plus petit commun multiple: lcm • Manipulation de nombres premiers: primes, isprime, factor • Valeur absolue et signum: abs, sign • Triangle de Pascal (sous forme de matrice): pascal • Calcul de la factorielle: factorial • Combinatoire: nchoosek • Permutations: perms Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
28
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Fonctions de trigonométrie du cercle: sin, cos, tan, asin, acos, atan • Fonctions de trigonométrie hyperbolique: sinh, cosh, tanh, asinh, acosh,
atanh • Fonctions logarithmes: exp, log, log10 • Coordonnées cartésiennes en coord. polaires: cart2pol/pol2cart • Coordonnées cartésiennes en coord. sphériques: cart2sph/sph2cart • Fonction de Bessel J: besselj • Fonction d'erreur de Gauss: erf
E2
• Intégrale elliptique de Jacobi ou complète: ellipj Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Des fonctions scolaires majeures mais aussi utiles dans les domaines
suivants: Théorie des nombres (cryptographie RSA) Théorie combinatoire (utile dans certains cas d'application de statistiques avancées) Analyse fonctionnelle avec les fonctions logarithmes et exponentielle Physique en général (incluant astronomie, cosmologie, génie marin, génie civil) avec les fonctions trigonométrique et hyperboliques Physique nucléaire , thermodynamique et optique ondulatoire avec les fonctions de BesselJ, erreur de Gauss et elliptiques
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
29
Diapositive 57 E2
Cage à oiseau des scanners à résonnance magnétique nucléaire Excelsia; 03/06/2014
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les fondamentaux Rappels de quelques fonctions statistiques Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Valeurs extrêmes d'un vecteur (in extenso l'étendue): max/min • Moyenne arithmétique d'un vecteur: mean • Médiane d'un vecteur: median • Valeur modale d'un vecteur: mode • Écart-type biaisé ou non biaisé: std • Variance biaisée ou non biaisée: var • Coefficient de corrélation ou matrice des corrélations: corrcoef • Covariance ou matrice des covariances: cov Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
30
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Quelques fonctions d'estimateurs ponctuels élémentaires intégrés par
défaut dans Matlab (pour + il faut avoir le Toolbox de statistiques) • Pour le même prix (et moins…) à comparer à Minitab, R, Octave, Scilab
les fonctions sont ridicules (pour être poli…). Par ailleurs même le Toolbox de statistiques laisse à désirer par rapport à R
alphorm.com™©
Fondamentaux MATLAB 2013a
Les fondamentaux Générer des variables aléatoires Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
31
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Générer une variable aléatoire uniforme continue: rand • Mettre le générateur comme à l'ouverture de Matlab: rng('default') • Réutiliser l'état du générateur: s=rng, rng(s) • Générer une variable aléatoire Normale: randn • Générer une variable aléatoire discrète: randi
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Les seules fonctions génératrices de variables aléatoires sans toolbox • Comment reproduire une expérience aléatoire à l'identique • La possibilité avec un peu d'effort de générer presque n'importe quelle
autre variable aléatoire continue ou discrète sans toolbox
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
32
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les fondamentaux Utiliser et créer des constantes Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Constante pi: pi • Nombre d'Euler: exp(1) • Représentation de l'infini: Inf • Tradition pour créer ses propres constantes
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
33
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Le peu de constantes disponibles par défaut dans ce logiciel
d'ingénierie… • Comment choisir le niveau de précision de ces constantes (rappel):
format short, format long • Comment créer ses propres constantes (us et coutumes)
alphorm.com™©
Fondamentaux MATLAB 2013a
Les fondamentaux Manipulations de chaînes de caractères Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
34
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Créer une variable de texte • Afficher le texte associé à une variable sans afficher la variable: disp • Extraire une sous-chaîne • Nettoyer les chaînes vides parasites: strtrim • Convertir une chaîne en minuscules: lower • Convertir une chaîne en majuscules: upper • Concaténer des chaînes de caractères: strcat • Remplacer/Supprimer une sous-chaîne dans une chaîne: strrep • Déterminer si une chaîne se trouve dans une chaîne: strfind Fondamentaux MATLAB 2013a
alphorm.com™©
Plan • Trouver une sous-chaîne dans une chaîne: strmatch • Comparer deux chaînes (sensitif ou non à la casse): strcmp/strcmpi • Dissocier une chaîne sur la base d'un séparateur: strsplit • Convertir des chaînes en des nombres: str2num
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
35
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Les commandes de manipulations de chaînes de caractères (seulement
celles que j’ai vu être utilisées dans la pratique!) • Une mise en bouche aussi pour l'apprentissage ultérieurement du
langage de script • Certaines commandes de traitement de caractères se trouvent que dans
des Toolbox…
alphorm.com™©
Fondamentaux MATLAB 2013a
Les fondamentaux
Manipulations de dates
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
36
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Créer une variable de type date • Obtenir la date et l'heure actuelle sous forme de vecteur: clock • Obtenir simplement la date du jour: date, now • Recomposer un vecteur en une date et inversement: datestr/datenum • Décomposer une date en composante de vecteurs: datevec • Obtenir des infos sur une date: weekday, day, month, year • Générer un calendrier: calendar • Obtenir le nombre de jours restants entre la date du jour et la fin du
mois: eoday Fondamentaux MATLAB 2013a
alphorm.com™©
Plan • Ajouter une quantité donnée à une date: addtodate • Utilisation de tic et toc pour calculer le temps d'exécution
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
37
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Cas pratiques • Millisecondes fractionnaires (ou entières) entre deux dates/temps • Secondes fractionnaires (ou entières) entre deux dates/temps • Minutes fractionnaires (ou entières) entre deux dates/temps • Heure fractionnaires (ou entières) entre deux dates/temps • Jours fractionnaires calendaires (ou entiers) entre deux dates • ??? Mois fractionnaires (ou entiers) entre deux dates ??? • ??? Années fractionnaires (ou entières) entre deux dates ???
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Les fonctions de dates majeures disponibles dans Matlab sans toolbox • Le constat qu'il manque beaucoup de fonctions triviales qui devraient
être natives (en comparaison à R ou même Excel) comme weeknum, yearfrac, monthfrac, openworkdays, hour, minute, etc.
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
38
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les fondamentaux
Interactions utilisateur
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
Fondamentaux MATLAB 2013a
alphorm.com™©
Plan • Pourquoi interagir avec l'utilisateur • Afficher un message à l'utilisateur: msgbox • Demander une information à l'utilisateur: input • Créer une boîte de dialogue de saisie: inputdlg • Demander une couleur à l'utilisateur: uisetcolor • Demander à l'utilisateur où stocker les variables: uisave • Demander à l'utilisateur où se trouvent les variables stockées: uiopen • Demander à l'utilisateur un emplacement de stockage (particulièrement
utile pour les graphs plus tard): uigetdir Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
39
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Afficher une barre d'attente: waitbar (et test performance avec tic/toc) • Afficher un choix à l'utilisateur: questdlg • Créer un "menu" à choix pour l'utilisateur: menu • Créer une liste à choix pour l'utilisateur: listdlg
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Les commandes d'interactions (seulement les plus utilisées dans la
pratique en dehors du développement d’interfaces!) • Une mise en bouche pour l'apprentissage ultérieur du langage de script
MATLAB et des GUI
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
40
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les fondamentaux Fusionner des tableaux ou matrices Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Fondamentaux MATLAB 2013a
Plan • Intérêt des tables (relativement nouveau pour contrecarrer R) • Création d'une table: table • Création d'une table avec étiquettes de colonnes
IV2
• Convertir une matrice en tableau: array2table • Dimension d'un tableau: height/width • Fusionner des tableaux d'étiquettes identique: join • Faire une jointure interne de deux tableaux: innerjoin • Résumé d'un tableau: summary • Appliquer une fonction à un vecteur d'un tableau: varfun Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
IV3
alphorm.com™©
41
Diapositive 82 IV2
table([5;12;23;2;15;6],... {'cheerios';'pizza';'salmon';'oreos';'lobster';'pizza'},... 'VariableNames',{'Age','FavoriteFood'},... 'RowNames',{'Amy','Bobby','Holly','Harry','Marty','Sally'}) http://www.mathworks.ch/ch/help/matlab/matlab_prog/access-data-in-a-table.html ISOZ Vincent; 01/04/2014
IV3
http://www.mathworks.ch/ch/help/matlab/ref/varfun.html ISOZ Vincent; 01/04/2014
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Appliquer une fonction à des lignes: rowfun
Fondamentaux MATLAB 2013a
IV4
alphorm.com™©
Ce qu’on a couvert • Nous avons couvert une structure qui va prendre de plus en plus
d'importance dans les années à venir pour le statisticiens habitués à R et dont l'employeur utilise Matlab
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
42
Diapositive 83 IV4
http://www.mathworks.ch/ch/help/matlab/ref/rowfun.html ISOZ Vincent; 01/04/2014
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les données Enregistrer et ouvrir des fichiers Matlab (rappels)
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Sauver/Charger l'espace de travail *.mat: save/load • Défragmenter l’espace de travail: pack • Sauver/Charger un fichier script Matlab *.m: edit/run
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
43
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Comment gérer (sauvegarder/ouvrir) les fichiers classiques de Matlab
*.mat ou *.m
alphorm.com™©
Fondamentaux MATLAB 2013a
Les données Gérer les dossiers
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
44
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Authentifier le dossier de travail par défaut en cours: pwd • Changer le dossier d'enregistrement par défaut en modifiant le
raccourci de l'icône Matlab (MS Windows) • Choisir la cible de navigation du panneau de dossier: cd… • Lister les dossiers de scripts avec path • Utiliser addpath pour charger de multiples dossiers de scripts • Utiliser rmpath pour enlever des dossiers de script ajoutés
antérieurement • Appeler le gestionnaire de dossiers de dossier avec pathtool
Fondamentaux MATLAB 2013a
alphorm.com™©
Plan • Utiliser savepath pour enregistrer l'état des dossier pour un session
ultérieure • Remettre à zéro les dossiers de scripts avec restoredefaultpath • Gérer les toolbox actifs en modifiant les dossiers de scripts actifs
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
45
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Comment gérer les dossiers de travail et de scripts pour gérer ses
fichiers de manière plus efficace
alphorm.com™©
Fondamentaux MATLAB 2013a
Les données Gérer les dossiers et fichiers Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
46
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Ouvrir un dossier quelconque dans l'explorateur windows: winopen • Lister les dossiers et fichiers d’un dossier: ls • Lister uniquement les fichiers de type Matlab d'un dossier: what • Vérifier si un fichier existe: exist • Chercher la localisation d'un fichier ou d'une fonction: which • Supprimer un fichier (et dangers y relatifs…): delete • Activer la suppression dans la corbeille: recycle('on') • Créer un dossier: mkdir • Supprimer un dossier (avec tout son contenu): rmdir(foldername,'s') alphorm.com™©
Fondamentaux MATLAB 2013a
Plan • Déplacer (et éventuellement en même temps renommer) un fichier ou
un dossier d'un dossier à un autre: movefile • Ouvrir n'importe quel fichier autre que Matlab dans son application
associée: open
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
47
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Comment naviguer dans les dossiers, gérer leur contenu, créer des
dossiers et ouvrir des fichiers quelconques (très utile pour la gestion du reporting automatisé!)
alphorm.com™©
Fondamentaux MATLAB 2013a
Les données Exporter/Importer des fichiers de données *.csv/*.txt Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
48
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Importer des données d'un fichier *.csv (ou *.txt): csvread, importdata,
fopen/textscan • Importer des données textes du web: urlread • Fusionner des données numériques importées: vertcat • Exporter des matrices: csvwrite
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Comment importer/exporter des données de fichiers textes classiques
avec du script pur • Comment fusionner des données importées • Informer de l’absence de fonctions natives pour importer/exporter
certains fichiers courants Minitab, SPSS, SAS, etc. (en comparaison au package foreign de R…) et pour l’export de structures et cellules composées de mélanges de données. • L’import de fichiers XML se fera dans le chapitre de scripting car
nécessite d’écrire un dizaine de lignes de scripts.
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
49
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les données Exporter/Importer des fichiers de données *.xls/*.xlsx Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Importer/Exporter un fichier de données numériques *.xlsx: xlsread • Exporter des données au format xls/xlsx: xlswrite
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
50
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Comment importer/exporter des données de fichiers Microsoft Office
Excel bien structurées
alphorm.com™©
Fondamentaux MATLAB 2013a
Les données Importer des données avec l’assistant Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
51
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Importer des données avec l’assistant Matlab sous différentes structures • Importer des données avec l’assistant Matlab en générant le script
automatiquement • Importer des données avec l’assistant Matlab en générant une fonction
de script
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Découverte de l’assistant d’import de MATLAB avec ses différentes
options
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
52
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les données Remarques
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • L’import de fichiers XML se fera lors de l’étude du langage de script • Sans toolbox aucun moyen simple à ma connaissance avec du script pur
d’accéder à des SGBDR comme mySQL, Oracle, SQL Server, Microsoft Office Access, etc. • Il existe des fichiers compilés en C/C++ développés par des amateurs
(MATLAB Central) qui permettent d’interfacer quelques rares SGBDR mais aucune garantie quant à leur maintenance sur le long terme!
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
53
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Data sets de démos pour les graphiques et autres Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
Fondamentaux MATLAB 2013a
alphorm.com™©
Plan • La commande logo , spy, peaks (…) • Jeux de données pour graphiques ou analyses statistiques • Comprendre ce qui est exportable dans
MS Excel et ce qui ne l'est pas
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
54
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Quelques démos de MATLAB • Le dossier de jeu de données de MATLAB • Ce qui exportable et ce qui ne l'est pas dans des tableurs
alphorm.com™©
Fondamentaux MATLAB 2013a
Les graphiques Assistant graphique
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
55
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Rappels sur la structure de données de plots 2D/3D • Présentation générale de l’assistant graphique
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Génération d’un graphique à partir de l’assistant • Personnalisation du graphique avec l’assistant • Ajout d’éléments sur le graphique • Transcription des modifications en tant que script
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
56
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Contrôler la fenêtre graphique Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Gestion des fenêtres
de graphiques modales
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
57
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Contrôler la couleur de la grille
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Comment masquer les barres d'outils des fenêtres de graphiques • Comment changer le titre des fenêtre et masquer la numérotation • Comment contrôler la position des fenêtres et leur taille • Comment mettre une couleur de fond à la fenêtre
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
58
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Plot à points/lignes de fonctions de R à R2 Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plot simple
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
59
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Piège des proportions des axes avec Matlab…
Fondamentaux MATLAB 2013a
alphorm.com™©
Choix des types de traits et points
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
60
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Superposition de plots 2D et ajout de lignes de références et légendes
Fondamentaux MATLAB 2013a
alphorm.com™©
Graph avec barres d'erreurs
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
61
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Graph semi-log en X
Fondamentaux MATLAB 2013a
alphorm.com™©
Graph semi-log en Y
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
62
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Graph log-log
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Graphiques à points ou à lignes 2D les plus classiques comme base de
travail triviale (sans Toolbox) • Pour des centaines d'exemples en plus:
http://www.mathworks.com/matlabcentral/fileexchange/index?page=3 &term=chart&utf8=%E2%9C%93 ou simplement l'aide de Matlab (dans chaque Toolbox!).
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
63
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Création de compositions graphiques Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Subplots avec titres
multiples
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
64
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Le principe (majeur!) de la construction de compositions de graphiques
multiples! • La création de fenêtre graphiques modale multiples avec la commande
figure et la manière de toutes les fermes avec close all
alphorm.com™©
Fondamentaux MATLAB 2013a
Les graphiques Utiliser des lettres grecques dans les titres et labels
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
65
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Utilisation de la syntaxe LaTex
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • L'utilisation de lettres grecques dans titres, labels et légendes (ou
ailleurs) en utilisant l’interpréteur LaTex
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
66
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Gérer les dates en abscisses Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Gérer les dates en abscisses
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
67
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Le principe de contrôle des dates pour l’axe des abscisses dans les
graphiques simples ou combinés
alphorm.com™©
Fondamentaux MATLAB 2013a
Les graphiques Créer des graphiques à double axes Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
68
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Graphiques à doubles axes verticaux/horizontaux
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Les graphiques à points/lignes avec doubles axes verticaux • Les graphiques à points/lignes avec quadruples axes (double v/double
h)
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
69
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Diagrammes à barres 2D (verticaux/horizontaux) divers Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Diagrammes à barres 2D groupés/cumulés/mixes
E3
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
70
Diapositive 140 E3
Matlab n'a pour rappel a priori pas d'histogramme normalisé. C'est à l'utilisateur de normaliser en divisant par le total. Excelsia; 16/06/2014
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Histogrammes
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Le génération de diagrammes à barres verticaux et horizontaux
classiques avec quelques complications très courants • Constat que la génération de diagrammes à barres dans MATLAB
comporte relativement peu d'options par défaut (la normalisation n’est pas une option automatique par exemple). En comparaison, Microsoft Office Excel, R, Origin et de nombreux autres font a priori beaucoup mieux.
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
71
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Diagrammes à barres 3D verticaux divers Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Histogramme 3D et activation de la barre d'outils "Caméra"
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
72
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • La génération de diagrammes à barres 3D verticaux (le bar3h( ) étant
très très rare).
alphorm.com™©
Fondamentaux MATLAB 2013a
Fondamentaux Matlab 2013a
Les graphiques
Représenter des proportions avec des secteurs
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
73
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Diagramme à secteurs 2D
Fondamentaux MATLAB 2013a
alphorm.com™©
Diagramme à secteurs 3D
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
74
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • La génération de diagramme à secteurs dans Matlab comporte trop peu
d'options par défaut sans l'apport de toolbox. En comparaison, Microsoft Office Excel, R, Origin et de nombreux autres font beaucoup mieux/beaucoup plus vite. • La nécessite dans certains cas d'utiliser une toolbox externe
http://www.mathworks.com/matlabcentral/fileexchange/27786-3d-piecharts-with-a-touch-of-style
alphorm.com™©
Fondamentaux MATLAB 2013a
Les graphiques Utiliser les diagrammes à aires Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
75
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Graph à aires
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • La génération de diagrammes à aires dans Matlab comporte trop peu
d'options par défaut sans l'apport de toolbox. En comparaison, Microsoft Office Excel, R, Origin et de nombreux autres font beaucoup mieux/beaucoup plus vite. • Utiliser la technique habituelle des diagrammes à aire pour faire des
intervalles de confiance
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
76
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Créer un histogramme angulaire Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Histogramme angulaire
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
77
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Les histogrammes angulaires pour les observations
(comptages/fréquences) dans un plan
alphorm.com™©
Fondamentaux MATLAB 2013a
Les graphiques Créer un diagramme compas (phaseurs) Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
78
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Diagramme compas
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Le diagramme « compas » pour représenter des phaseurs mais qui peut
être détourné de son objectif premier
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
79
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Analyse de Pareto
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Analyse de Pareto
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
80
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Une analyse de Pareto sur des valeurs numériques avec une
représentation simple
alphorm.com™©
Fondamentaux MATLAB 2013a
Les graphiques Diagrammes matriciels
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
81
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Diagrammes matriciels
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • La création d’un diagramme (graphique) matriciel avec histogramme en
diagonale • Les options sont a priori très limitées par rapport à R
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
82
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Créer des heatmap de corrélation Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Heatmap de corrélation
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
83
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Une heatmap simple avec personnalisation de la barre de couleurs
alphorm.com™©
Fondamentaux MATLAB 2013a
Les graphiques Créer un graphe avec effet de loupe Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
84
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Graphe avec loupe
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • La création d’une zone de « zoom » dans un graphe plan
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
85
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Tracer des courbes paramétriques 3D Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Courbes 3D paramétriques statiques ou animées
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
86
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Cas scolaires des courbes paramétriques 3D
Fondamentaux MATLAB 2013a
alphorm.com™©
Les graphiques Tracer des surfaces paramétriques 3D Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
87
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Surfaces 3D paramétriques
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Cas scolaires de surfaces paramétriques 3D. Fonctionnalité utile pour
définir des volumes canoniques dans lesquels se déroulent des expériences
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
88
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Plot de surfaces « analytiques » 3D avec diverses options visuelles
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Piège des axes avec
Matlab… • Choix d'afficher
la grille de fond ou non • Choix de la limite
de traçage • Choix de la
perspective • Choix du zoom
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
89
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Graph 3D avec grille et jeu de couleurs
Fondamentaux MATLAB 2013a
alphorm.com™©
Graph 3D en surface avec ou sans transparence
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
90
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Graph 3D avec grille triangulaire ou rectangulaire
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Éviter le piège de la proportion des axes • Choisir d'afficher le quadrillage ou non • Contrôler les bases de la perspectives (zoom, angle, limites de plot) • Choisir le type de dégradé de couleurs/colormap (heat, jet, etc.) • Mettre de la transparence • Et de nombreuses autres options…
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
91
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Afficher les isoclines/équipotentielles en 2D ou 3D Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Projeter les isoclines sur un plan
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
92
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Graph 3D courbures de niveau (isoclines)
Fondamentaux MATLAB 2013a
alphorm.com™©
Graph 2D des isoclines projetés dans le plan
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
93
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Graph 2D du gradient des isoclines
Fondamentaux MATLAB 2013a
alphorm.com™©
Graph 3D avec isoclines,contrôle de la perspective et de la lumière
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
94
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Cas les plus courants de représentation des isoclines/équipotentielles
(sans gradients, sans lignes de champs)
alphorm.com™©
Fondamentaux MATLAB 2013a
Les graphiques Afficher les vecteurs normaux, équipotentielles et lignes de champs
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
95
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Vecteurs normaux, gradients et équipotentielles (isoclines) avec lignes de champs
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Comment afficher les vecteurs normaux à une surface • Comment afficher les gradients vectoriels sur un plan Z • Comment afficher les équipotentielles (isoclines) avec les lignes de
champs sur un plan Z
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
96
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Plot de surfaces provenant de mesures
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Surfaces de mesures
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
97
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Deux méthodes différentes pour transformer des vecteurs de mesures
en surfaces visualisables
Fondamentaux MATLAB 2013a
alphorm.com™©
Les graphiques Mappage d'images
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
98
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Mappage d'images sur plot 2D
Fondamentaux MATLAB 2013a
alphorm.com™©
Mappage d'images sur plot 3D
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
99
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Comment utiliser une image en fond d’un plot 2D (utile en
géostatistique quand on a pas la toolbox adéquate) • Comment mapper une image sur une surface plongée dans une espace
3D (utile pour les publications/magazines posters de vulgarisation scientifique)
alphorm.com™©
Fondamentaux MATLAB 2013a
Les graphiques Sphère avec texture
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
100
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plot d'une sphère avec texture
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Un cas classique pour des simulations de mécanique céleste,
d'ingénierie aérospatiale ou météorologiques
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
101
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Représentation d’un parallélépipède Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plot d’un parallélépipède
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
102
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Deux techniques différentes pour tracer un parallélépipède (sonde) qui
pourra ensuite être entourée de champs divers d’études
alphorm.com™©
Fondamentaux MATLAB 2013a
Les graphiques Animation d'un graphique 2D ou 3D avec export Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
103
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Animations 3D avec export *.gif ou *.avi
IV5
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Principe d'animation des graphiques 2D ou 3D avec exports dans
différents formats communs
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
104
Diapositive 207 IV5
Attention c'est animé! ISOZ Vincent; 03/05/2014
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Analyse d’équations de champs Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Analyse d’équations de champs
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
105
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Un cas classique d’école dans MATLAB d’analyse et de représentation
de champ vectoriel et d’équipotentielles à partir d’une fonction explicite
alphorm.com™©
Fondamentaux MATLAB 2013a
Les graphiques Analyse d'instantanés de champs de vecteurs Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
106
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Analyse d'instantanés de champs de vecteurs
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Comment décortiquer un jeu de données représentant un champ
vectoriel étape par étape • Différentes représentations classiques et intuitives des champs
vectoriels • Une analyse critique du piège du niveau de détails de certaines
représentations
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
107
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Régression MCO univariée (sans Toolbox!) Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Régression avec assistant
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
108
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Régression OLS sans toolbox avec polyfit
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Comment faire une régression linéaire OLS univariée sans Toolbox • Remarque: Aller sur le File Exchange de Matlab pour sans toolbox et
sans réinventer la roue obtenir les statistiques classique de la régression linéaire, régression orthogonale (Deming), la régression non paramétrique, les régressions généralisées, la régression quantile, l'interpolation de Lagrange, LOESS,…
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
109
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Les graphiques Interpolation par spline (sans Toolbox!) Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Interpolation par splines 2D/3D
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
110
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Comment faire une interpolation 2d ou 3D par splines sans utiliser la
"Spline toolbox" de Matlab • Remarque: Aller sur le File Exchange de Matlab pour sans toolbox et
sans réinventer la roue obtenir de nombreux autres modèles de splines
alphorm.com™©
Fondamentaux MATLAB 2013a
Les graphiques Exporter en tant qu’image
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
111
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Comment enregistrer une image du graphique sur le disque • Comment copier une image du graphique dans le presse-papier
alphorm.com™©
Fondamentaux MATLAB 2013a
Analyse Introduction
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
112
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Informations • Découverte des fonctions intégrées dans le moteur de base (sans toolbox) relatifs à l'analyse
mathématique • Pas de fonctions intégrées pour l'optimisation linéaire ou non linéaire sans la Optimization
Toolbox
• Pas de fonctions intégrées pour le calcul des limites sans la Symbolic Toolbox • Pas de fonctions intégrées pour le calcul des séries de Taylor sans la Symbolic Toolbox • Pas de fonctions intégrées pour le calcul des séries de Fourier sans la Symbolic Toolbox • Pas de fonctions intégrées pour la résolution d'ODL sans la Symbolic toolbox • Pas transformée de Laplace ou transformée en Z sans la Symbolic toolbox
alphorm.com™©
Fondamentaux MATLAB 2013a
Analyse Évaluer la valeur d'un polynôme univarié Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
113
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Découverte de la fonction polyval
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Une fonction triviale…
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
114
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Analyse Recherche de zéros de polynômes univariés Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
roots et fzero • Découverte de la fonction roots en combinaison avec des techniques de
représentation graphique des racines • Découverte de la fonction fzero
pour les zéros de fonctions non linéaires (non polynomiales)
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
115
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Deux fonctions triviale particulièrement utiles en physique et dans
certains modèles en finance…
alphorm.com™©
Fondamentaux MATLAB 2013a
Analyse Recherche de minima/maxima local de fonctions uni et bivariées Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
116
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
fmbind • Découverte de la fonction fminbnd en combinaison avec des techniques
de représentations graphiques pour chercher les minima
Fondamentaux MATLAB 2013a
alphorm.com™©
find • Utilisation des fonctions fminsearch ou find pour rechercher un
optimum dans une fonction symbolique ou une fonction matricielle et représentation sous forme graphique
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
117
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Deux fonctions de recherche d'optimum locaux de fonction univariées
ou bivariées • Il n'y a pas de fonctions sans toolbox permettant de trouver un
optimum global
alphorm.com™©
Fondamentaux MATLAB 2013a
Analyse Convolution et Déconvolution (discrètes) Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
118
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Contrôle du bon fonctionnement en conformité avec la théorie de la
fonction conv et deconv • Application de la conv à la somme des variables aléatoires
indépendantes et remarque vis-à-vis de la simulation de Monte-Carlo
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Les bases de la convolution qui sera particulièrement utile finalement
aux ingénieurs actifs dans le traitement du signal ou de l'image
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
119
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Analyse Intégration pseudo-symbolique de polynômes ou numérique générale Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
Fondamentaux MATLAB 2013a
alphorm.com™©
Plan • Intégration de polynômes univariés avec la fonction polyint • Intégration de fonctions explicites univariées avec la fonction integral • Intégration numérique avec la méthode du trapèze avec la fonction
trapez et cumtrapz • Intégration de fonctions explicites bivariées avec la fonction integral2
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
120
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Les cas d'intégrations mathématiques scolaires les plus classiques • Constat de l'absence d'intégration symbolique générale sans la
Symbolic Toolbox
alphorm.com™©
Fondamentaux MATLAB 2013a
Analyse Dérivation pseudo-symbolique de polynômes ou numérique générale Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
121
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Dérivation de polynômes univariés avec la fonction polyder • Dérivation numérique avec la fonction diff
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Les cas des dérivations mathématiques scolaires les plus classiques • Le problème des arrondis dues aux précisions des nombres • Constat de l'absence de dérivation symbolique générale sans la
Symbolic Toolbox
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
122
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Analyse Résolution numérique d'équations différentielles ordinaires
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Résolution numérique d'équations différentielles d'ordre un ou deux
avec la fonction ode45 et plots classiques associés (cas particulier de l’ODE non linéaire pendule non forcé et non amorti)
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
123
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Les cas de résolution d'une équation différentielle non-linéaire d'ordre 2
scolaire typique en passant par une transformation en un système de deux EDO d'ordre 1
alphorm.com™©
Fondamentaux MATLAB 2013a
Analyse Résolution numérique de systèmes d'équations différentielles ordinaires Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
124
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Résolution numérique de systèmes d'équations différentielles ordinaires
avec la fonction ode45 et plots classiques associés (cas particulier du système ODE non linéaire couplé de Lotka-Volterra)
dN = αN − βNP dt dP = δNP − γN dt
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Nous venons de constater que puisque l'algorithme ode45 a besoin
obligatoirement en entrée d'EDO du premier ordre que finalement que l'on travaille sur une unique EDO ou sur un système d'EDO, le principe est en grossièrement toujours le même
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
125
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Analyse Résolution numérique d'équations différentielles partielles paraboliques 1D Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Résolution numérique d'équations différentielles partielles avec la
fonction pdepe et plots classiques associés (cas particulier de l'équation de la chaleur)
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
126
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Problème de départ
Doit être transformé sous la forme générale:
Fondamentaux MATLAB 2013a
alphorm.com™©
Étape 1: PDEX
Qu’on écrit explicitement en:
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
127
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Étape 2: PDEXIC
Fondamentaux MATLAB 2013a
alphorm.com™©
Étape 3: PDEXBC Forme générale des BC:
Borne gauche:
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Borne droite:
alphorm.com™©
128
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • La fonction pdex pour définir l'équation différentielle • La fonction pdexic pour définir les conditions initiales (ic: initial
conditions) • La fonction pdexbc pour définir les conditions aux bords (bc: boundary
conditions) • Le mix des trois fonctions précédentes dans la fonction pdepe pour
résoudre le problème
alphorm.com™©
Fondamentaux MATLAB 2013a
Analyse Transformée de Fourier discrète Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
129
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Découverte de la fonction de transformée de fourier discrète fft pour
détecter les fréquences et amplitudes des harmoniques masquées sous jacentes et sa transformée inverse ifft
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Une fonctionnalité majeure dans le traitement acoustique ou de tout
signal en général • Une fonction également parfois utilisée en finance pour détecter des
harmoniques
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
130
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Traitement d'images Remarques préalables (communes) sur les images, vidéos et sons Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Informations • Restriction aux fonctions natives (pas d'usage de la Signal
Processing Toolbox ou de la Image Processing Toolbox) • Sources fichiers en post-traitement et non en temps réel
(pas d'usage de l'Acquisition Toolbox) • Garder en tête qu'une vidéo n'est qu'une succession
d'images (accessoirement avec du son…) • Que les principes de bases étudiés car ce ne sont "que" des
maths en fin de compte et un peu de logique et de bon sens Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
131
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Traitement d'images Obtenir des informations sur les images Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan imfinfo : obtenir les métadonnées sur les images size : pour obtenir directement la taille d'une image
imread : pour stocker une image dans une variable
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
132
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Quelques fonctions disponibles sans la Image Processing Toolbox pour
obtenir des informations (parfois importantes) sur les images
alphorm.com™©
Fondamentaux MATLAB 2013a
Traitement d'images Traiter les couches des images et enregistrer le résultat Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
133
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan image: afficher une image proprement dans une figure Travailler sur les pixels des couches RVB Convertir en niveaux de gris
imwrite: enregistrer l'image
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Comprendre la structure matricielle d'une image RGB • Quelques fonctions disponibles sans la Image Processing Toolbox pour
effectuer quelques traitements triviaux sur les images
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
134
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Traitement d'images Traiter les pixels d’une image et enregistrer le résultat Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan Utiliser notre compréhension de la structure d'une image RGB pour filtrer une image sur sa luminosité (utile en Astronomie, Astrophysique, Médecine nucléaire)
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
135
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert Un autre cas classique des traitements d'images en travaillant cette fois non pas sur une couche alpha sur son ensemble mais pixel par pixel. Permet de faire du filtrage mais aussi avec les connaissances adéquates en mathématiques de la reconnaissances de formes (mais privilégier quand même la Toolbox ad hoc pour ne pas recréer la roue)
alphorm.com™©
Fondamentaux MATLAB 2013a
Traitement d'images Dessiner sur une image et enregistrer le résultat Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
136
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan Utile lors de traitements vidéos ou d'images pour mettre en évidences des zones reconnues par l'algorithme pour mise en évidence (souvent associé à du comptage automatique ensuite)
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert Une méthode pour mettre en évidence visuellement une zone d'intérêt sur une image (ou vidéo). La tradition fait qu'on utilise souvent des rectangles mais on peut jouer aussi avec la fonction scatter pour dessiner des petites croix ou autre…
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
137
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Traitement d'images Comparer des images
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan Comparaison d'une image à une image étalon: très utile pour l'analyse automatisée de défauts de production
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
138
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert Une méthode pour mettre en évidence visuellement une différence (nouvel objet, impureté, défaut) entre une image quelconque et son image étalon correspondante
alphorm.com™©
Fondamentaux MATLAB 2013a
Traitement d'images Superposer des images
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
139
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan Superposition d'images en transparence (particulièrement utile en astronomie et astrophysique)
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert Une technique simple pour superposer deux images avec fonds noir de façon éventuellement automatisée dans le cadre d'installation astronomiques autonomes.
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
140
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Traitement de vidéos Obtenir des informations sur les vidéos Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Extraire les métadonnées d'une vidéo à l'aide de la fonction mmfileinfo
(sans la Vision System Toolbox…)
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
141
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • La manière d'extraire des informations simples sur un fichier vidéo
alphorm.com™©
Fondamentaux MATLAB 2013a
Traitement de vidéos Jouer une vidéo et en extraire des images Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
142
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Extraire des images d'une vidéo avec la fonction read • Jouer une vidéo (sans la Vision System Toolbox…)
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Extraire une image d'une vidéo (pour faire le post-traitement que l'on
veut dessus par la suite) • Contourner l'absence de lecteur vidéos dans MATLAB sans toolbox
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
143
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Traitement de vidéos Exporter toutes les images d'une vidéo Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Extraire toutes les images d'une vidéo pour post-traitement automatisé
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
144
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Un sujet extrêmement important pour l'analyse et le traitement
automatisé en post-production… reste plus qu'à recompiler le tout en une vidéo…
alphorm.com™©
Fondamentaux MATLAB 2013a
Traitement de vidéos Compiler des images dans une vidéo Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
145
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Compiler des images dans une vidéo unique à l'aide des fonctions
Videowriter et writevideo
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Après avoir fait un post-traitement d'images exportées d'une vidéo
comment recomposer cette dernière (sans le son bien évidemment)
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
146
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Traitement de sons Obtenir des informations sur les sons Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Extraire les métadonnées d'un son à l'aide de la fonction audioinfo (sans
la Signal Processing Toolbox…)
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
147
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • La manière d'extraire des informations simples sur un fichier audio
alphorm.com™©
Fondamentaux MATLAB 2013a
Traitement de sons Contrôler la lecture d'un son Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
148
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Play: Fonction pour jouer un son • Pause: Fonction pour faire une pause dans la lecture • Resume: Pour reprendre la lecture • Stop: Pour arrêter la lecture définitivement
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Le contrôle de lecture d'un son • Nécessite absolument la création d'un GUI
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
149
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Traitement de sons Afficher le spectre d'un son Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan Comprendre la structure d'un fichier son pour en représenter le spectre d'amplitude mono ou double canal
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
150
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert Un grand classique pour tous ceux qui ont déjà travaillé avec un fichier d'éditions sonore
alphorm.com™©
Fondamentaux MATLAB 2013a
Traitement de sons Transformée de Fourier discrète d'un son Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
151
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan Retour sur ce qui a été vu dans le chapitre d'analyse mais appliqué à un son
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert Une transformation importante pour analyser les aigus et les basses d'un son et pouvoir faire par la suite quelques transformations mathématiques ad hoc
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
152
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Traitement de sons Générer (créer) ou compiler des sons Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan • Générer des sons artificiels • Séquences des sons • Jouer des sons en parallèle
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
153
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert Un exemple de génération (création) et in extenso de transformation simple de sons qui peut mener avec de l'imagination et de la maîtrise mathématique à: du filtrage, de la compression dynamique, de l'ajout d'écho, etc.
alphorm.com™©
Fondamentaux MATLAB 2013a
Scripts Introduction concernant le scripting Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
154
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Expliquer l'importance du scripting • Petites informations concernant le scripting dans Matlab ces dernières années • Problèmes du langage de script Matlab
IV6
• Bonnes pratiques (effacer les variables existantes, nettoyer la fenêtre de
commande, fermer toutes les fenêtres) • Transformer en précompilé (*.p) • Compilation en C++/.Net ou JAVA avec la Compiler toolbox pour applications
industrielles (~7'000$) • Les *.exe nécessitent malheureusement le MATLAB Compiler Runtime (MCR)
(566MB!!! mais gratuit…)
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Quelques informations pour la culture générale MATLAB • Pour aller un peu plus en profondeur:
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
155
Diapositive 309 IV6
-
pas de typage language procédural (non orienté objet) pas de distinction entre procédure et fonctions compilation x32/x64
ISOZ Vincent; 02/10/2014
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Scripts Préférences de l'éditeur de script Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
Fondamentaux MATLAB 2013a
alphorm.com™©
Plan • Désactiver l'ouverture automatique des derniers fichiers *.m • Désactiver la limite de page • Désactiver la tabulation automatique
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
156
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert Les préférences de l'éditeur de script les plus demandées par les praticiens de MATLAB
alphorm.com™©
Fondamentaux MATLAB 2013a
Scripts Écrire des commentaires et utiliser l'autocomplétion Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
157
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan • Rappels sur les traditions de la tabulation • Créer des lignes de commentaires • Commenter plusieurs lignes • Créer des blocs d'éxecution • Utiliser l'autocomplétion • Utiliser l'accès aux sous-fonctions
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Une méthode de travail (de base…) pour avoir un script bien structuré • Une méthode de travail pour pouvoir comprendre ce script plus tard • Des méthodes de confort d'écriture et de consultation
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
158
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Scripts Définir le texte d'aide
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan Associer simplement une petite aide pour les petits scripts qui s'affichera à l'appel de la commande help nom_du_script
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
159
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert • Les fondamentaux de la création d'une aide avec une fonction • Il est possible évidemment d'aller beaucoup plus loin en créant des
fichiers d'aide Matlab
alphorm.com™©
Fondamentaux MATLAB 2013a
Scripts Syntaxe des fonctions
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
160
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan Rappel sur le nommage des fichiers pour pouvoir utiliser les fonctions Fonctions à n paramètres obligatoires en entrée et m paramètres en sortie Gérer les arguments optionnels Utilisation de fonctions locales ou imbriquées Fonctions récursives
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert • Quelques généralités ultra-classiques concernant l'écriture de fonctions
spécifiques au langage de script MATLAB • Une bonne pratique pour écrire des scripts plus facilement
maintenables (diviser pour mieux régner)
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
161
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Scripts Portée des variables
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan Variables locales vs globales Variables persistantes
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
162
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert Des méthodes d'utilisation et de déclaration des variables qui peuvent être très utiles dans certaines situations
alphorm.com™©
Fondamentaux MATLAB 2013a
Scripts Gestion des erreurs
Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
163
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Plan Gérer les erreurs et exceptions de façon (relativement…) générale avec try …
catch
Fondamentaux MATLAB 2013a
alphorm.com™©
Ce qu’on a couvert Une technique (relativement) générale de gestion des erreurs très courante dans le domaine de la programmation informatique
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
164
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Scripts Utilisation des structures conditionnelles Site : http://www.alphorm.com Blog : http://www.alphorm.com/blog Forum : http://www.alphorm.com/forum Fondamentaux MATLAB 2013a
Vincent ISOZ Formateur et Consultant indépendant Ingénierie statistique et financière
alphorm.com™©
Plan Introduction auxif … elseif … else … end Introduction aux switch … case … otherwise … end Rappels sur les relations d'ordres ==, ~=, <, >, >=,<= associées aux conditions Rappels sur les opérateurs logiques booléens AND &, et OR associés aux conditions&
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
165
alphorm.com-support de la formation Les fondamentaux de Matlab 2013A
14/06/2014
Ce qu’on a couvert La première structure majeure commune à tous les langages de script et de programmation de la planète
Fondamentaux MATLAB 2013a
TOUTE UTILISATION EN DEHORS D'ALPHORM EST INTERDITE
alphorm.com™©
166