Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
Matrix Definitions for the Matlab Package
Calling Sequence
function(M, ...)
Matlab[function](M, ...)
Description
A MatlabMatrix is a matrix defined in MATLAB memory space. In Maple, the matrix is always named as a string, with double quotes. For example, Matlab[inv]("M") computes the inverse of the variable, "M", which is defined in MATLAB. If a variable M is defined in Maple, it will be unaffected by, and have no effect on the stated call. The two calls, Matlab[inv](M) and Matlab[inv]("M") are very different.
A MapleMatrix is any Maple expression that is equivalent to a matrix. For example Array(1..2,[1,2]) is equivalent to [1,2], or Vector([1,2]). A MapleMatrix can be an rtable (Array, Matrix or Vector), a table, or a constant (numeric or complex numeric or a symbolic constant such as Pi or infinity). All elements of the MapleMatrix must be of type constant.
MATLAB has access to variables defined in its memory space, and Maple has access to variables defined in its memory space. Variables are not automatically shared between memory spaces; they must be explicitly set or read.
For example, if a user starts Maple and defines a matrix "M" by typing M := Matrix([[1,2],[3,4]]); the memory space looks like this.
Maple Memory
+--------------+
| M |
If that user then opens a link to MATLAB and sets a variable, "X", in MATLAB to the same value as "M" (using the command Matlab[setvar]("X", M);), the memory is as follows.
Maple Memory MATLAB Memory
+--------------+ +---------------+
| M | | X |
The variable M is a MapleMatrix, and "X" is a MatlabMatrix. The command Matlab[inv](M) copies the matrix M to MATLAB memory space, defining a temporary variable result_for_maple in the process. MATLAB computes the inverse of result_for_maple and sends the result back to Maple.
The command Matlab[inv]("X") computes the inverse of "X" and sends the result to Maple.
It is possible to define the name "M" in both Maple and MATLAB. After the command Matlab[setvar]("M", Pi), the memory spaces would be as follows.
| M | | X, M |
Consider the two commands Matlab[det](M), and Matlab[det]("M"). The subtle difference between these commands makes a significant difference in their results. The first command returns the determinant of the 2x2 matrix, M=[[1,2],[3,4]], which is -2. The second command returns the determinant of the 1x1 matrix, "M"=[Pi], which is Pi.
Examples
-2
3.14159265400000010
See Also
Matlab, Matlab[evalM], Matlab[getvar], Matlab[setvar]
Download Help Document