Thursday, April 29, 2010

Getting Started with Matlab


Download Video tutorial about Getting Started with Matlab


You can start MATLAB by double clicking on the MATLAB icon that should be on the desktop
of your computer. This brings up the window called the Command Window. This window
allows a user to enter simple commands. To clear the Command Window type clc and next press
the Enter or Return key. To perform a simple computations type a command and next press the
Enter or Return key. For instance,
s = 1 + 2
s =
3
fun = sin(pi/4)
fun =
0.7071
In the second example the trigonometric function sine and the constant are used. In MATLAB
they are named sin and pi, respectively.
Note that the results of these computations are saved in variables whose names are chosen by the
user. If they will be needed during your current MATLAB session, then you can obtain their
values typing their names and pressing the Enter or Return key. For instance,
s
s =
3
Variable name begins with a letter, followed by letters, numbers or underscores. MATLAB
recognizes only the first 31 characters of a variable name.
To change a format of numbers displayed in the Command Window you can use one of the
several formats that are available in MATLAB. The default format is called short (four digits
after the decimal point.) In order to display more digits click on File, select Preferences…, and
next select a format you wish to use. They are listed below the Numeric Format. Next click on
Apply and OK and close the current window. You can also select a new format from within the
Command Window. For instance, the following command
format long
changes a current format to the format long. To display more digits of the variable fun type
fun
fun =
0.70710678118655
To change a current format to the default one type
format short
fun
fun =
0.7071
To close MATLAB type exit in the Command Window and next press Enter or Return key. A
second way to close your current MATLAB session is to select File in the MATLAB's toolbar
and next click on Exit MATLAB option. All unsaved information residing in the MATLAB
Workspace will be lost.

There are three kinds of numbers used in MATLAB:
• integers
• real numbers
• complex numbers
Integers are enterd without the decimal point
xi = 10
xi =
10
However, the following number
xr = 10.01
xr =
10.0100
is saved as the real number. It is not our intention to discuss here machine representation of
numbers. This topic is usually included in the numerical analysis courses.
Variables realmin and realmax denote the smallest and the largest positive real numbers in
MATLAB. For instance,
realmin
ans =
2.2251e-308
Complex numbers in MATLAB are represented in rectangular form. The imaginary unit -1 is
denoted either by i or j
i
ans =
0 + 1.0000i
In addition to classes of numbers mentioned above, MATLAB has three variables representing the nonnumbers:
• -Inf
• Inf
• NaN
The –Inf and Inf are the IEEE representations for the negative and positive infinity, respectively.
Infinity is generated by overflow or by the operation of dividing by zero. The NaN stands for the
not-a-number and is obtained as a result of the mathematically undefined operations such as
0.0/0.0 or 8-8.
List of basic arithmetic operations in MATLAB include six operations

Operation Symbol

  1. addition +
  2. subtraction -
  3. multiplication *
  4. division / or \
  5. exponentiation ^
MATLAB has two division operators / - the right division and \ -
produce the same results
rd = 47/3
rd =
15.6667
ld = 47\3
ld =
0.0638

Download Video tutorial about Getting Started with Matlab

0 comments:

Related Posts Plugin for WordPress, Blogger...

http://mosttutorials.blogspot.com/

civil engineering,electrical and other engg. software video tutorials.ebook and setups for free.... SAP2000,ETABS,SAFE,Autocad,revit Architecture,MS Project,Primavera ,Matlab,PSpice and much more

  © Blogger templates Newspaper III by Ourblogtemplates.com 2008

Back to TOP