introduction au logiciel matlab ”cours bloc” -...
Post on 24-Jul-2018
251 Views
Preview:
TRANSCRIPT
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Introduction au logiciel MATLAB”Cours bloc”
Freddy MUDRY et Michel ETIQUE
Freddy.Mudry@eivd.ch, Michel.Etique@eivd.ch
ecole d’ingenieurs du canton de Vaud (eivd)
Departement d’electricite et d’informatique
institut d’Automatisation industrielle (iAi)
Introduction au logiciel MATLAB”Cours bloc” – p.1/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Organisation du "cours bloc"
8h10-8h55 env. Théorie, exemples08h55-9h40 Exercices10h05-10h50 env. Théorie, exemples10h50-11h35 Exercices
12h40-13h25 env. Théorie, exemples13h25-14h10 Exercices14h20-15h05 env. Théorie, exemples15h05-15h50 Exercices
Introduction au logiciel MATLAB”Cours bloc” – p.2/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Documents, listings
s:\regulation\matlab\cours_bloc (dudomaine instituts)\\iai_serveur\serveur...\regulation\matlab\cours_bloc(du domaine EINET)http://iai1.eivd.ch
Introduction au logiciel MATLAB”Cours bloc” – p.3/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Applications de MATLAB (eivd)
mathématiqueslaboratoire de physiqueélectronique et systèmes analogiques (filtres,Bode, réponses temporelle, etc)théorie des circuitstraitement de signalrégulation automatiqueetc
Introduction au logiciel MATLAB”Cours bloc” – p.4/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Introduction
Nombre de problèmes de l’ingénieurne peuvent être résolus que numériquementsont où doivent être formulés de manièrematricielle
=⇒ MATLAB est un logiciel spécialisé dans le cal-cul matriciel numérique
Introduction au logiciel MATLAB”Cours bloc” – p.5/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Introduction
opérations/manipulationsvectorielles/matricielles (inv, eig, diag)
résolution (numérique) d’équationsdifférentielles (ode23 et ode45)création/manipulation de polynômes(polyval, conv)traitement de données expérimentales (min,mean, sort, std)interface graphique (plot, mesh, surf)
Introduction au logiciel MATLAB”Cours bloc” – p.6/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Introduction
opérations/manipulationsvectorielles/matricielles (inv, eig, diag)résolution (numérique) d’équationsdifférentielles (ode23 et ode45)
création/manipulation de polynômes(polyval, conv)traitement de données expérimentales (min,mean, sort, std)interface graphique (plot, mesh, surf)
Introduction au logiciel MATLAB”Cours bloc” – p.6/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Introduction
opérations/manipulationsvectorielles/matricielles (inv, eig, diag)résolution (numérique) d’équationsdifférentielles (ode23 et ode45)création/manipulation de polynômes(polyval, conv)
traitement de données expérimentales (min,mean, sort, std)interface graphique (plot, mesh, surf)
Introduction au logiciel MATLAB”Cours bloc” – p.6/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Introduction
opérations/manipulationsvectorielles/matricielles (inv, eig, diag)résolution (numérique) d’équationsdifférentielles (ode23 et ode45)création/manipulation de polynômes(polyval, conv)traitement de données expérimentales (min,mean, sort, std)
interface graphique (plot, mesh, surf)
Introduction au logiciel MATLAB”Cours bloc” – p.6/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Introduction
opérations/manipulationsvectorielles/matricielles (inv, eig, diag)résolution (numérique) d’équationsdifférentielles (ode23 et ode45)création/manipulation de polynômes(polyval, conv)traitement de données expérimentales (min,mean, sort, std)interface graphique (plot, mesh, surf)
Introduction au logiciel MATLAB”Cours bloc” – p.6/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Le Workspace MATLAB
Introduction au logiciel MATLAB”Cours bloc” – p.7/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
L’aide en ligne
help nom_de_commande
Introduction au logiciel MATLAB”Cours bloc” – p.8/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
La fonction plot et l’opérateur .
sinc (ϑ) =sin (ϑ)
ϑ
theta = linspace (−4∗pi ,4∗ pi , 100) ;
s inc = sin ( theta ) . / theta ;
f igure ( 1 ) , plot ( theta , s inc )
−15 −10 −5 0 5 10 15−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
Introduction au logiciel MATLAB”Cours bloc” – p.9/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Services Internet
http://www.mathworks.com
ftp.mathworks.com
http://www.scientific.de
http://www.calerga.com
http://www-rocq.inria.fr/scilab/
Introduction au logiciel MATLAB”Cours bloc” – p.10/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Boîtes à outils
traitement de signal (signal processingtoolbox),régulation automatique (control systemtoolbox),identification (system identification toolbox),réseaux de neurones (neural networkstoolbox),logique floue (fuzzy logic toolbox),calcul symbolique (symbolic math toolbox),
Introduction au logiciel MATLAB”Cours bloc” – p.11/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Boîtes à outils
simulation de systèmes non-linéaires(Simulink),systèmes de puissance (Power Systemsblockset)télécommunications (Communication toolbox)
Introduction au logiciel MATLAB”Cours bloc” – p.12/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Utilisateurs
MATLAB est un quasi-standard au niveauacadémique
de plus en plus utilisé par les entrepriseslargement appécié par les ingénieurs (boîtes àoutils)
Introduction au logiciel MATLAB”Cours bloc” – p.13/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Utilisateurs
MATLAB est un quasi-standard au niveauacadémiquede plus en plus utilisé par les entreprises
largement appécié par les ingénieurs (boîtes àoutils)
Introduction au logiciel MATLAB”Cours bloc” – p.13/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Utilisateurs
MATLAB est un quasi-standard au niveauacadémiquede plus en plus utilisé par les entrepriseslargement appécié par les ingénieurs (boîtes àoutils)
Introduction au logiciel MATLAB”Cours bloc” – p.13/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
uicontrol et uimenu
Introduction au logiciel MATLAB”Cours bloc” – p.14/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Création d’axes et de sliders
%D e f i n i t i o n du systeme G( jw )
T = 0 . 1 ;
numG = 1 ;
denG = [ T , 1 ] ; %[T ,1 ]
%Reponse f r e q u e n t i e l l e
[ A, phi , omega ] = bode (numG, denG) ;
%Systeme d ’ axes pour reponse f r e q u e n t i e l l e
f igure (1)
axe1 = axes ( ’ Uni ts ’ , ’ Normalized ’ , . . .
’ Pos i t ion ’ , [ 0 . 1 , 0 . 3 , 0 . 8 , 0 . 5 ] ) ;
pl1 = semilogx ( omega,20∗ log10 ( A) ) ;
%Sl ide r pour mod i f i ca t i on pos i t i on de T
sl1 = uicontrol ( ’ Uni ts ’ , ’ Normalized ’ , ’ Sty le ’ , ’ S l i de r ’ , . . .
’ Pos i t ion ’ , [ 0 . 1 , 0 . 1 , 0 . 8 , 0 . 0 5 ] , . . .
’ Min ’ ,0 .001 , ’ Max’ , 1 , ’ Value ’ , 0 . 1 , . . .
’ CallBack ’ , ’ s l ider_change_01 ’ ) ;Introduction au logiciel MATLAB”Cours bloc” – p.15/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
Fonction CallBack
slider_change_01.m
%Lecture de la valeur courante du s l i d e r et mise a jour de G( jw )
denG = [ get ( s l1 , ’ Value ’ ) , 1 ] ; %[T ,1 ]
%Calcul des reponses
[ A ] = bode(numG, denG, omega) ;
%Mise a jour du graphique
set ( pl1 , ’ Ydata ’ , l in2db ( A) )
Introduction au logiciel MATLAB”Cours bloc” – p.16/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
MATLAB est serveur OLE
Commande de la hauteur d’une sphère
e . g .M A T L A B
S I M U L I N K
W I N D O W SO L E
. . .
P C - P E N T I U M - W I N D O W S N T 4 . 0
R é g u l a t e u rC a r t e
d ' a c q u i s i t i o nN T
d r i v e r
i a
u a ( t )
L aR a
C a p t e u r d ep o s i t i o n àu l t r a s o n s
x
0
A l g o r i t h m e s ,s t r a t é g i e d e c o m m a n d e ,s i g n a u x & p a r a m è t r e s
I n t e r f a c eu t i l i s a t e u r
f _ 0 1 _ 0 1 . e p s
Introduction au logiciel MATLAB”Cours bloc” – p.17/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
MATLAB est serveur OLE
Panneau d’instruments virtuels
Introduction au logiciel MATLAB”Cours bloc” – p.18/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
MATLAB est serveur OLE
Inclusion de la librairie engine.h
#include " engine . h" / / MATLAB ENGINE
Engine ∗ hMatlab ;
bool MatlabOpened ;
Introduction au logiciel MATLAB”Cours bloc” – p.19/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
MATLAB est serveur OLE
Ouverture de MATLAB
bool MatlabOpen ( void )
{
i f ( ! MatlabOpened )
{
hMatlab = engOpen( " \ 0 " ) ;
i f ( hMatlab == NULL) return f a l se ;
MatlabOpened = true ;
}
return t rue ;
}
Introduction au logiciel MATLAB”Cours bloc” – p.20/21
�
� �
�
Ai
iutomatisation
n s t i t u t d '
n d u s t r i e l l e
MATLAB est serveur OLE
Transfert vers MATLAB
void Trans2MATLAB( )
{
mxArray ∗ T;
int Buf ferS ize ;
double ∗ Buf fer ;
Buf ferS ize = . . .
T = mxCreateDoubleMatrix ( Buf ferS ize , 2 , mxREAL) ;
mxSetName( T , " u_acq " ) ;
Buf fer = mxGetPr ( T ) ;
engPutArray ( hMatlab , T ) ;
mxDestroyArray ( T ) ;
}Introduction au logiciel MATLAB”Cours bloc” – p.21/21
top related