joPAS
 
English Spanish
Web joPAS

Home

ScreenShots

Downloads

 

Documents

 

Developers

Forums

Links

 
Grupo PAS
 
SourceForge.net Logo
Support joPAS

 
   
 

 

PRESENTATION

 

The joPAS API has been created by Group PAS of the University of Deusto. It allows the programmer to use the Octave language calculation power from Java, the user can create programs in Java with the advantage of implementing all the mathematical part in Octave. In addition, the syntax of Octave is compatible with Matlab, and all the sentences created for Matlab also can be used in joPAS.

Users would only have to call to the function execute() with the code of Octave like argument in String format. The code would be executed in Octave. Also, joPAS allows to get and to set variables between Java and Octave to be used in the calculations. Moreover joPAS permits the visualization of a matrix with graphs using the jopasLabel class that draws the matrix graph.

 

The following example is Java code that uses some functions of joPAS:

//Creates a 1x1 Matrix called "FC"
Matrix FCMatrix = new Matrix(2500.0, "FC");
//Load the previous matrix named "FC" to Octave
jopas.Load(FCMatrix);


//Creates a 1x1 Matrix called "FR", you can do it like the previous one.
jopas.Load(5000.0, "FR");

String R = "1";
String A = "40";

//Executes the Octave commands using local variables
jopas.Execute("[N,W]=cheb1ord(FC/10000,FR/10000," + R + "," +A+ ")");
jopas.Execute("[B,A]=cheby1(N," + R + ",W)");
jopas.Execute("[H,F]=freqz(B,A,512,20000)");
jopas.Execute("modulodB=20*log10(abs(H))");
jopas.Execute("fase=unwrap(angle(H))");
jopas.Execute("Wc=W*10000");

/**
*XYPlots of "F" and "modulodB", the plot title is "Módulo", the
* X label is "Frecuencia (Hz)" and Y label is "Módulo (dB)".
*/

this.jopasLabel2.paintLabel("F", "modulodB", "Módulo","Frecuencia (Hz)", "Módulo (dB)");
//The same with "F" and "fase" variables
this.jopasLabel1.paintLabel("F", "fase", "Fase", "Frecuencia (Hz)", "Fase (rad)");

/**
* Shows the value of Octave's "N" variable in the label.
* jopas.Save always returns Matrix variable type.
* In this case the dimensions of Matrix is well known, is a 1x1 matrix
* So we access straight to (0,0) position of the Matrix
*/

this.jTextField6.setText(Double.toString(jopas.Save("N").getRealAt(0,0)));
this.jTextField5.setText(Double.toString(jopas.Save("Wc").getRealAt(0,0)));

 

 
 

Grupo PAS - Universidad de Deusto - 2005
Javier Vicente Saez