Maple für Professional
Maple für Akademiker
Maple für Studenten
Maple Personal Edition
Maple Player
Maple Player für iPad
MapleSim für Professional
MapleSim für Akademiker
Maple T.A. - Testen & beurteilen
Maple T.A. MAA Placement Test Suite
Möbius - Online-Courseware
Machine Design / Industrial Automation
Luft- und Raumfahrt
Fahrzeugtechnik
Robotics
Energiebranche
System Simulation and Analysis
Model development for HIL
Anlagenmodelle für den Regelungsentwurf
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematikausbildung
Technik
Allgemein- und berufsbildende Schulen
Testen und beurteilen
Studierende
Finanzmodelle
Betriebsforschung
Hochleistungsrechnen
Physik
Live-Webinare
Aufgezeichnete Webinare
Geplante Veranstaltungen
MaplePrimes
Maplesoft-Blog
Maplesoft-Mitgliedschaft
Maple Ambassador Program
MapleCloud
Technische Whitepapers
E-Mail Newsletters
Maple-Bücher
Math Matters
Anwendungs-Center
MapleSim Modell-Galerie
Anwenderberichte
Exploring Engineering Fundamentals
Lehrkonzepte mit Maple
Maplesoft Welcome-Center
Resource-Center für Lehrer
Help-Center für Studierende
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