Applying MATLAB algorithms in. Net
In scientific research and engineering applications, a large number of mathematical calculations are often carried out, including matrix operations. These operations are generally difficult to do with manual precision and fast, but with the help of computer programming corresponding program to do approximate calculation. The current popular use of basic, FORTRAN and C language programming, not only need to have a deep understanding of the algorithm, but also need to master the language of the grammar and programming skills. For most scientists, there are some difficulties in both skills. Usually, the programming process is also complex, not only consumes human and material resources, but also affects the work process and efficiency. In order to overcome these difficulties, the United States Mathwork Company in 1967 launched the "Matrix Laboratory" (abbreviated as MATLAB) software package, and constantly updated and expanded. The latest version of 6.x (Windows environment) is a powerful and efficient interactive software package that facilitates scientific and engineering computing. This includes applications such as general numerical analysis, matrix operations, digital signal processing, modeling, and system control and optimization, and integrates applications and graphics in an easy-to-use integrated environment. In this environment, the MATLAB language representation of the problem is the same as its mathematical expression, and it does not need to be programmed according to the traditional method. However, as a new computer language, MATLAB needs to learn it in a systematic way, if it wants to use it freely and give full play to its power. However, the use of MATLAB programming operations and human scientific calculation of the idea and expression of the exact same, it is not like learning other high-level language-such as BASIC, Fortran and C and so difficult to master. Practice has proved that you can learn the basic knowledge of MATLAB in a few 10 minutes, in just a few hours of use can be initially mastered it. This allows you to perform efficient and creative calculations. Matlab greatly reduces the user's mathematical basis and computer language knowledge requirements, and programming efficiency and computational efficiency is very high, but also on the computer directly output results and beautiful graphics copy, so it is indeed an efficient research assistant. Since the launch of the United States, spread the world.
MATLAB algorithm is an excellent algorithm, we in the software development process, especially in the database development, to carry out data aggregation, statistical analysis, and then according to the aggregated data generated charts (including column, PIE, four, radar charts, etc.), this demand is very common.
Because the MATLAB algorithm has the powerful computation processing function, so in many software already used it, for example makes a sales forecast, if is based on the previous sales data, may use the MATLAB algorithm to the past sales Data processing (such as function, matrix of a series of operations, Or use some of the knowledge of operational research to data processing, and then by the MATLAB algorithm to produce the relevant data of the beautiful graphics output, to obtain a scientific theoretical basis of the program, the management of our ideas into the computer program design, so that the software solution is not a simple computerization tool, But a synthesis of the wisdom of many disciplines crystallization!
Microsoft's. NET development tools, combined with database SQL SERVER, is the best choice for developing database applications! We can use the data in SQL Server with the MATLAB algorithm to process, but also can write their own algorithm to the COM, in. NET Reference. In the use of MATLAB algorithm, the function of graphics output is often ignored, the following example, is the use of Matlab out of the graph
First in. NET, reference Matlab object library (MATLAB application (version 6.5) Type library), the author uses the MATLAB 6.5 version, and then add a picture box on the form PictureBox1, used to display the picture;
A Button1 is used to invoke MATLAB and load graphics.
Code:
dim Strmatlab As String "defines the MATLAB statement string
' Displays the sine chart
Private Sub button1_click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles Button1.clic k
Dim matlab as object
' establish MATLAB application
Matlab = CreateObject ("Matlab.application")
' Minimize MATLAB command window
Matlab.minimizecommandwindow ()
' matlab statement
Strmatlab = ' t=2:0.2:4*pi;y= Sin (t);p lot (t,y) " 
" executes the MATLAB algorithm
Matlab. Execute (Strmatlab)
' generates a JPG of graphics c:\test1.jpg
Matlab. Execute ("Print (GCF, '-djpeg ', ' C:\Test1 ')")
' exits Matlab, frees up resources
Matlab. Quit ()
MatLab = nothing
' appears in the picture box
pictureBox1.Image = New Bitmap ("c:\Test1.jpg")
End Sub
Private Sub button2_click (ByVal Sender as System.Object, ByVal e as System.EventArgs) Handles button2.click
Dim matlab as object
Matlab = CreateObject ("Matlab.application")
Strmatlab = "sale=[100";p ie3 (sale,[0 0 1 0 0],{' Company A ', ' Company B ', ' Company C ', ' Company d ', ' Company E '} '
Matlab. Execute (Strmatlab)
Matlab. Execute ("Print (GCF, '-djpeg ', ' C:\Test2 ')")
Matlab. Quit ()
matlab = nothing
pictureBox1.Image = New Bitmap ("c:\Test2.jpg")
End Sub