Maple Professionel
Maple Académique
Maple Edition Étudiant
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professionel
MapleSim Académique
Maple T.A. - Suite d'examens de classement
Maple T.A. MAA Placement Test Suite
Möbius - Didacticiels de mathématiques en ligne
Machine Design / Industrial Automation
Aéronautique
Ingénierie des véhicules
Robotics
Energie
System Simulation and Analysis
Model development for HIL
Modélisation du procédé pour la conception de systèmes de contrôle
Robotics/Motion Control/Mechatronics
Other Application Areas
Enseignement des mathématiques
Enseignement de l’ingénierie
Enseignement secondaire et supérieur (CPGE, BTS)
Tests et évaluations
Etudiants
Modélisation financière
Recherche opérationnelle
Calcul haute performance
Physique
Webinaires en direct
Webinaires enregistrés
Agenda des évènements
Forum MaplePrimes
Blog Maplesoft
Membres Maplesoft
Maple Ambassador Program
MapleCloud
Livres blancs techniques
Bulletin électronique
Livres Maple
Math Matters
Portail des applications
Galerie de modèles MapleSim
Cas d'Etudes Utilisateur
Exploring Engineering Fundamentals
Concepts d’enseignement avec Maple
Centre d’accueil utilisateur Maplesoft
Centre de ressources pour enseignants
Centre d’assistance aux étudiants
Go to Maple Portal Maple Portal for Engineers
Connecting to MATLAB
The Matlab package provides users with commands to communicate with MATLAB directly from their Maple sessions, and to translate existing MATLAB routines to Maple code. The commands found in the Matlab package can be accessed by loading the package into the Maple workspace using the command.
See Configuring a Computer for MATLAB for details on how to configure the Maple-MATLAB link.
Opening a connection to MATLAB
Communication between Maple and MATLAB is established through the call.
Evaluating MATLAB expressions in Maple
The Matlab package in Maple gives users the ability to evaluate expressions and perform Matrix operations on Matrices, defined and stored in Maple or MATLAB, directly in MATLAB. The package provides you with two methods to evaluate your expressions in MATLAB. These methods will be elaborated upon in the next two sections.
Evaluation in MATLAB using the , and commands
Maple expressions can be evaluated in MATLAB using the , and commands. More information about these commands can be found in the help system by typing the following commands into the worksheet: , and
The command evaluates the expression in MATLAB. The command assigns a value to a variable in MATLAB, while the command returns the result stored in a MATLAB variable. The next two examples illustrate how to use these commands.
Example 1
The version of MATLAB with which the Maple-MATLAB connection is established can be determined using the and commands:
** Note: MATLAB returns the result of any expression in a variable called ans if no other variable has been specified by the user.
Example 2
The following example calculates the product of two Matrices, , in MATLAB and returns the result in Maple. The Matrices are defined in both Maple and MATLAB.
The Matrices defined in and are copied to the MATLAB variables and using the command.
:
The command can be used to ensure that the variables defined in and were actually stored
in the variable and . As expected, the command returns if a variable is defined in MATLAB, and otherwise.
=
The product of the two Matrices can now be calculated in MATLAB.
Evaluation in MATLAB using pre-defined commands in the Matlab package
The Matlab package also provides the users with the ability to perform several Matrix manipulation operations in MATLAB without the explicit use of the , and commands. These commands are listed in the table below:
compute the Cholesky factorization of a Matrix (defined in Maple or MATLAB) using MATLAB
compute the determinant of a Matrix (defined in Maple or MATLAB) using MATLAB
compute the eigenvalues of a Matrix (defined in Maple or MATLAB) using MATLAB
compute the discrete Fourier transform of a vector in MATLAB
compute the inverse of a Matrix (defined in Maple or MATLAB) using MATLAB
compute the LU decomposition of a Matrix (defined in Maple or MATLAB) using MATLAB
compute the QR orthogonal-triangular decomposition of a Matrix (defined in Maple or MATLAB) using MATLAB
compute the size of a Matrix (defined in Maple or MATLAB) using MATLAB
compute the transpose of a (defined in Maple or MATLAB) using MATLAB
For instance, using the command, the determinant of a Matrix can be evaluated directly in MATLAB, and the result will be automatically returned in Maple. It is important to note, that all of the commands listed in the table above can be applied to Matrices defined in both Maple and MATLAB.
It is important to remember, that the Matrix defined in the variable is stored in MATLAB and not in Maple.
Calling a MATLAB 'm file' into Maple
Another very useful feature of the Matlab package is the ability to use a pre-existing MATLAB functions in the Maple environment. The following example calculates the Fibonacci Sequence using a MATLAB function which generates the Fibonacci number for different values of .
The following command is used to change the MATLAB working directory to the location of the .m file.
C:\Program Files\Maple 13\data/134portal/134FibonacciNum.m
We can run the FibonacciNum function directly from Maple using the command.
We can also write a Maple procedure that generates a Fibonacci Sequence based on the FibonacciNum MATLAB command.
Executing the procedure defined above, returns a vector which contains the Fibonacci numbers for
Translating a MATLAB 'm file' into Maple code
The Matlab package in Maple also gives us the ability to translate an 'm file' into Maple code. Translation is achieved using the command. More information on this command and the options associated with it can be found in the help system by typing:
The following example illustrates how the FibonacciNum.m file which was discussed in the previous section can be translated in Maple code.
Warning, `k` is implicitly declared local to procedure `FibonacciNum`
The warning statements generated above act as a means of informing the user that the loop variable, , and the variable, , were converted to local variables by Maple.
The FibonancciNum for any value of can now be calculated entirely in Maple.
Closing a connection to MATLAB
Communication between Maple and MATLAB can be terminated at any time through the call.
Download Help Document