Friday, January 27, 2017

Graphics and graphical user interface programming

MATLAB supports developing applications with graphical user interface (GUI) features. MATLAB includes GUIDE[23] (GUI development environment) for graphically designing GUIs.[24] It also has tightly integrated graph-plotting features. For example, the function plot can be used to produce a graph from two vectors x and y. The code:
x = 0:pi/100:2*pi;
y = sin(x);
plot(x,y)
produces the following figure of the sine function:
Matlab plot sin.svg
A MATLAB program can produce three-dimensional graphics using the functions surf, plot3 or mesh.
[X,Y] = meshgrid(-10:0.25:10,-10:0.25:10);
f = sinc(sqrt((X/pi).^2+(Y/pi).^2));
mesh(X,Y,f);
axis([-10 10 -10 10 -0.3 1])
xlabel('{\bfx}')
ylabel('{\bfy}')
zlabel('{\bfsinc} ({\bfR})')
hidden off
   
[X,Y] = meshgrid(-10:0.25:10,-10:0.25:10);
f = sinc(sqrt((X/pi).^2+(Y/pi).^2));
surf(X,Y,f);
axis([-10 10 -10 10 -0.3 1])
xlabel('{\bfx}')
ylabel('{\bfy}')
zlabel('{\bfsinc} ({\bfR})')
This code produces a wireframe 3D plot of the two-dimensional unnormalized sinc function:     This code produces a surface 3D plot of the two-dimensional unnormalized sinc function:
MATLAB mesh sinc3D.svg     MATLAB surf sinc3D.svg
In MATLAB, graphical user interfaces can be programmed with the GUI design environment (GUIDE) tool.[25]

Interfacing with other languages

MATLAB can call functions and subroutines written in the programming languages C or Fortran.[26] A wrapper function is created allowing MATLAB data types to be passed and returned. The dynamically loadable object files created by compiling such functions are termed "MEX-files" (for MATLAB executable).[27][28] Since 2014 increasing two-way interfacing with Python is being added.[29][30]
Libraries written in Perl, Java, ActiveX or .NET can be directly called from MATLAB,[31][32] and many MATLAB libraries (for example XML or SQL support) are implemented as wrappers around Java or ActiveX libraries. Calling MATLAB from Java is more complicated, but can be done with a MATLAB toolbox[33] which is sold separately by MathWorks, or using an undocumented mechanism called JMI (Java-to-MATLAB Interface),[34][35] (which should not be confused with the unrelated Java Metadata Interface that is also called JMI). Official MATLAB API for Java was added in 2016.[36]
As alternatives to the MuPAD based Symbolic Math Toolbox available from MathWorks, MATLAB can be connected to Maple or Mathematica.[37][38]
Libraries also exist to import and export MathML.[39]

No comments:

Post a Comment