| Home | My Accounts | Newsletter | News Flash | Contact Us | Search |
|
|
See also Setting up the MATLAB Environment at MCSR and Getting Started with MATLAB at MCSR, Part II Matlab solves various equations and obtains solution for some mathematical functions.
To activate MATLAB on willow or sweetgum enter: matlab. To get a flavor of what matlab
has to offer enter: help after Matlab is
activated. Their Web Site, www.mathworks.com, contains online help
that includes instructions on how to set up and run small examples. For further
information, users may check MCSR Website: http://www.mcsr.olemiss.edu/computing/matlab.html Examples given below show
both the strength and the simplicity of Matlab. Matlab contains a variety of
mathematical and statistical functions. Below is an example that finds the
value for Error Function erfc. Please note
that x is the input to the Error Function and y is the result or
the output from the Error Function. >>
x=.78 x = 0.7800 >>
y=erfc(x) y = 0.2700 To
find the roots of a polynomial p=x^3 -2*x -5 in Matlab,
user at the Matlab prompt >>, enters: p =
[1 0 -2 -5] ; please note that numbers in bracket represent
the coefficient of the polynomial. To
that Matlab responds by: p = 1
0 -2 -5 Then
user enters: r= roots(p). At
this point the roots are printed. Here is how: First
Matlab is activated by entering: matlab. <
M A T L A B > Copyright 1984-2002 The MathWorks, Inc. Version 6.5.0.180913a
Release 13 >>
p = [1 0 -2 -5] ;;;;;;;;;;; First line
entered by user after matlab is activated.;;;;;;;;; p = 1
0 -2 -5 >>
r= roots(p) ;;;;;;;;;; Second and last
line entered by user. ;;;;;;;;;;;;;;;;; r
= ;;;;;;;;;;Followings are the
result or the roots for the above equation.;;;;;;;;;;;;; 2.0946 -1.0473 + 1.1359i -1.0473 - 1.1359i Please
notice that one of the roots is real and the other two are imaginary as the
highest power in this equation is 3, (x^3), we expect to obtain 3 roots. In high school we learned how
to solve simple linear equations with 2 or at most 3 variables. Users may find
an example of solving linear equations with many variables at: http://www.mcsr.olemiss.edu/appssubpage.php?pagename=imsl.inc Also
at high school they taught us how to solve quadratic equations with one
variable e. g. x^2 -1=0, whose two roots are plus and minus one. The above
example on this article solves this family of equations. What we didn 't learn in high school or
even in the first few years of college was the combinations of the above two
systems. That is a system of equations that contain several variables as well
as some quadratic and cross product terms. Such a system of equations is called
non-linear system of equations. When the laws of nature and the laws of physics
are formulated in mathematical terms the resulting equations become messy,
nasty and difficult to solve. These equations are not simple equations like
x^2-1=0, and their solutions requires developing new methods which involve a
lot of analysis. In our next article we see how PV-WAVE and others solve these
systems of equations. Users needing help with Matlab or other mathematical or statistical software should
send email to assist@mcsr.olemiss.edu,. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||
