Biomodèles/Biomodels
SCILAB 3.0 PAS A PAS
SCILAB 3.0 STEP-TO-STEP

Jacques-Deric Rouault

Laboratoire de Neurobiologie de l'Apprentissage, de la Mémoire et de la Communication. CNRS UMR 8620, Bat. 446, Université Paris-Sud, F91400 Orsay

Orscilab
ORSCILAB

20 LES MATRICES DE COMPLEXES/FLOTTANTS
20 MATRICES OF COMPLEX/FLOAT
20.1 Matrices particulières / Particular matrices
Version 2.1.3 du 28 Février 2005 / Version 2.1.3, February 28th 2005
Biomodèles/Biomodels N°1 pp 0x-0y Décembre 2004 December 2004

Retour à la Table générale / Return to the General table
Index général / General index
Passage à la section suivante 20.2 / Next section 20.2

a
zeros (Matrice, Matrix)
zeros (Hypermatrice, Hypermatrix)
Matrice nulle
Null matrix

b
ones (Matrice, Matrix)
ones (Hypermatrice, Hypermatrix)
Matrice un
One matrix

c
eye (Matrice, Matrix)
Matrice unité
Unit matrix

d
testmatrix (Matrice, Matrix)
magi (testmatrix, Matrice, Matrix)
Carré magique (Matrice, Matrix)
Magic square (Matrice, Matrix)
frk (testmatrix, Matrice, Matrix)
Matrice de Franck (Matrice, Matrix)
Franck's matrix (Matrice, Matrix)
hilb (testmatrix, Matrice, Matrix)
Matrice de Hilbert (Matrice, Matrix)
Hilbert's matrix (Matrice, Matrix)

e
isreal (Matrice, Matrix)
f
isinf (Matrice, Matrix)
g
isnan (Matrice, Matrix)
h
diag (Vecteur, Vector)

La fonction zeros crée une matrice remplie de zéros.
The function zeros returns a matrix filled with zeros.

// PROGRAMME SPAS200101
m = zeros (2,3),

Ch20Sc01-Fig01

L'appel de zeros(x) crée une matrice remplie de zéros de la même taille que x.
Calling zeros(x) returns a matrix filled with zeros of the same size as x..


// PROGRAMME SPAS200102
m1 = [1, 2, 3; 4, 5, 6];
m2 = zeros (m1),

Ch20Sc01-Fig02

La fonction zeros s'applique aussi aux hypermatrices.
The function zeros also applies to hypermatrices.


// PROGRAMME SPAS200103
h = zeros (2,3,4),

Ch20Sc01-Fig03

La fonction ones crée une matrice remplie de uns.
The function zeros returns a matrix filled with ones.

// PROGRAMME SPAS200104
m = ones (2,3),

Ch20Sc01-Fig04

L'appel de ones(x) crée une matrice remplie de uns de la même taille que x.
Calling ones(x) returns a matrix filled with ones of the same size as x..


// PROGRAMME SPAS200105
m1 = zeros (3,4);
m2 = ones (m1),

Ch20Sc01-Fig05

La fonction ones s'applique aussi aux hypermatrices.
The function ones also applies to hypermatrices.


// PROGRAMME SPAS200106
h = ones (3,4,2),

Ch20Sc01-Fig06
  
La fonction eye crée une matrice unité remplie de zéros avec des uns sur la première diagonale.
The function eye returns a unit matrix filled with ones with ones on the first diagonal.

// PROGRAMME SPAS200107
m = eye (5,4),

Ch20Sc01-Fig07

L'appel de eye(x) crée une matrice unité de la même taille que x.
Calling eye(x) returns a unit matrix of the same size as x..


// PROGRAMME SPAS200108
m1 = zeros (3,4);
m2 = eye (m1),

Ch20Sc01-Fig08

La fonction eye ne s'applique pas aux hypermatrices.
It is not possible to apply the function eye to hypermatrices.

La fonction eye() crée une matrice unité de taille indéfinie. La taille est définie au premier appel.
The function eye() creates a unit matrix of undefined size. The size is defined at the first call .


// PROGRAMME SPAS200109
m1 = ones (),
m2 = [2, 2, 4; 6, 7, 8];
m3 = m1+m2,

Ch20Sc01-Fig09

La fonction testmatrix("magi",n) crée un carré magique de taille n.
The function testmatrix("magi",n) creates a magic square of size n.

// PROGRAMME SPAS200110
m = testmatrix ("magi",5),

Ch20Sc01-Fig10


La fonction testmatrix("frk",n) crée une matrice de Franck de taille n.
The function testmatrix("frk",n) creates a Franck's matrix of size n.

// PROGRAMME SPAS200111
m = testmatrix ("frk",5),

Ch20Sc01-Fig11


La fonction testmatrix("hilb",n) crée l'inverse d'une matrice de Hilbert de taille n.
The function testmatrix("hilb",n) creates the inverse of an Hilbert matrix of size n.

// PROGRAMME SPAS200112
m = testmatrix ("hilb",5),

Ch20Sc01-Fig12


La fonction booléenne isreal permet de tester si une matrice ne contient pas de valeurs complexes.
The boolean function isreal tests if a matrix does not contain a complex value.

// PROGRAMME SPAS200113
m = [1, 2+%i, 3; 4, 5, 6];
b = isreal (m),

Ch20Sc01-Fig13


Il est possible d'introduire une tolérance epsilon pour tester si la matrice ne contient pas de valeurs complexes dont la partie imaginaire soit supérieure en module à epsilon..
It is possible to introduce a tolearance epsilon to test if  the matrix does not contain complex values which imaginar part is upper than epsilon in absolute value.

// PROGRAMME SPAS200114
m = [1, 2+%i, 3; 4, 5, 6];
b = isreal (m, 1),

Ch20Sc01-Fig14

 
La fonction  isinf appliquée à une matrice de complexes retourne une matrice booléenne de même taille avec les valeurs %F ou %T selon que la valeur correspondante ne vaut pas ou vaut %inf (infini).
The  function isinf applied to a complex matrix returns a boolean matrix of the same size with the values %F or %T according to the value different from or equal to %inf (infinite).

// PROGRAMME SPAS200115
mc = [1, %inf+%i, 3+%inf*%i; 4, %inf, 6];
mb = isinf (mc),

Ch20Sc01-Fig15

NB : il y a un problème avec les parties imaginaires infinies.
Note : The is a problem with the imaginary parts infinite.

La fonction  isnan
appliquée à une matrice de flottants retourne une matrice booléenne de même taille avec les valeurs %F ou %T selon que la valeur correspondante ne vaut pas ou vaut %nan (n'est pas un nombre ).
The  function isnan applied to a float matrix returns a boolean matrix of the same size with the values %F or %T according to the value different from or equal to %nan (not a number).

// PROGRAMME SPAS200116
mc = [1, %nan, 3; 4, %nan, 6];
mb = isnan (mc),

Ch20Sc01-Fig16
i

Si l'une des valeurs de la matrice est complexe, la fonction isnan revoie %F partout.
If one of the values of the matrix is complex, the function isnan returns %F everywhere.

// PROGRAMME SPAS200117
mc = [1+%i, %nan, 3; 4, %nan, 6];
mb = isnan (mc),

Ch20Sc01-Fig17
i

La fonction  diag génère une matrice à partir du vecteur diagonale
.
The  function diag generates a matrix from a vector diagonal.

// PROGRAMME SPAS200118
v = [1, 2, 3, 4, 5, 6];
m =diag (v),

Ch20Sc01-Fig18
i

Retour à la Table générale / Return to the General table
Index général / General index
Passage à la section suivante 20.2 / Next section 20.2