MATLAB BUILDER JA 2 Podręcznik Użytkownika Strona 246

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 292
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 245
5 Sample Applications (Java)
Matrix Math Example
The purpose of the example is to show you the following:
How to assign more than one MATLAB function to a component class.
How to manually handle native memory management.
How to a ccess the component in a Java a pplication (
getfactor.java)by
instantiating
Factor and using the MWArray class library to handle data
conversion.
Note For complete reference inform atio n about the MWArray class
hierarchy, see the
com.mathworks.toolbox.javabuilder package.
How to bui ld and run the MatrixMathDemoApp application
This example builds a Java component to perform matrix math. The example
creates a program that performs C holesky, LU, and QR factorizations on a
simple tridiagonal m atrix (finite difference matrix) with the following form:
A=[2-1000
-12-100
0-1 2-1 0
00-12-1
000-12]
Yousupplythesizeofthematrixonth e command line, an d the progra m
constructs the matrix and performs the three factorizations. T he original
matrix and the results are printed to standard output. You may optionally
perform the calculations using a sparse matrix by specifying the string
"sparse" as the secon d parameter on the command line.
MATLAB Functions to Be Encapsulated
The following code defines the MATLAB functions used in the example.
cholesky.m
function [L] = cholesky(A)
5-16
Przeglądanie stron 245
1 2 ... 241 242 243 244 245 246 247 248 249 250 251 ... 291 292

Komentarze do niniejszej Instrukcji

Brak uwag