Sunday, January 18, 2015

MATLAB TuTer 1: Introduction to Matlab

MATLAB Tutorial 1: Basics & Essentials

Contents:

  • MATLAB introduction: 2
  • Definition: 2
  • Development: 2
  • Platforms: 2
  • History: 2
  • Installation and Directories: 2
  • MATLAB interface parts: 3
  • Getting Help: 4
  • MATLAB Fundamentals: 6
  • Basic Arithmetic and order of operations: 6
  • Exponents and Scientific Notation: 6
  • Working with Fractions and the Symbolic Math Toolbox 7
  • Defining and Using Variables and comments: 7
  • Adjusting the Display Precision: 8
  • Creating and Storing Values in Symbolic Variables: 8
  • Essential Mathematical Functions: 10
  • Factorial, Square Roots, and nth Roots: 10
  • Trigonometric Functions and their Inverses: 10
  • Hyperbolic Functions and their Inverses: 11
  • Exponentials and Logarithms: 12
  • Complex numbers: 12
  • Basic Calculations with Complex Numbers: 12
  • Calculating the Magnitude and Angle of Complex Numbers: 13
  • Trig Functions, Logarithms, and Exponentials with Complex Numbers: 14
  • Complex Numbers and the Symbolic Math Toolbox:

MATLAB introduction:

Definition:

MATLAB is an integrated technical computing environment that combines numeric computation, advanced graphics and visualization, and a high-level programming language.
MATLAB stands for Matrix Labtory. 

Development:

MATLAB is produced and developed by MATH WORKS Inc. which can be found at www.mathworks.com.
Note: this site is not directly assessable from some forbidden countries like in my case SUDAN country and I don't know WHY? or i know and am not comfort with that :( 

Platforms:

MATLAB can be used in WINDOWS (all flavors), LINUX, and some form of UNIX. But Math Works, Inc.,

History:

Basically MATLAB was a tool of BSD kind which used by Mathematics researchers and professors, then it become available for students and educators to help them in learning and analytical proposes.

Installation and Directories:

There is no free version of MATLAB is available from Math Works Ins, but always there is a licensed versions for education proposes are available at internet and there is too many suppliers for it now.
The easiest way to download a full package is via torrent download simply search for "torrent matlab R2014b" R2014b is the latest downloadable matlab version freely for now.
The versions I working with is R2013a and R2014a versions which includes all Toolboxes and Block sets for SIMULINK and other MATLAB components which now called MATLAB Apps
When you install MATLAB for the first time you have to enter the installation serial and the License file, so you should make sure you have it included in the source package you get.

Generally MATLAB will be installed under the directory (C:\Program Files\MATLAB\R2013a ) then we can find the executable file ( matlab.exe ) at the ( bin ) folder to run MATLAB. Or we can run it from START menu All programs then click on Matlab.
Note: information in this section may be very detailed but it considered a principles for new users. 

MATLAB interface parts:

Matlab interface

      When we start MATLAB we can see that the program interface is divided into five parts: current folder, command window, workspace, command history, and the Tool Strip or ribbon menu in the top.

      The Tool Strip or ribbon menu is a very nice addition to the new versions of MATLAB basically it contains three taps are: HOME, PLOTS, and APPS.

      The HOME tap includes the standard tools and options for: File, Variable, Code, Simulink, Environment, and Resources properties.

      The PLOTS tap includes a set of Plots layouts and designs to visualize your variables, this new tap make MATLAB easier to use and visualize data than using the commands in earlier versions.

      The APPS tap includes Graphical User Interface GUI applications for a various studies and analysis in many engineering fields each app package has its own GUI to interact with. This apps gives MATLAB a new flavor to introduce it capabilities to all students those thinks MATLAB is complex to use or it’s just for scientists, by introduce supporting for android and iOS platforms which used very widely today.

      The Current Folder window shows the current folder we working in, and it can be used as a file explorer to manipulate MATLAB files we working with using the explorer bar above it as in windows explorer bar.

      The Workspace window shows any variable we enter in the command windows and it obtains the value, type, minimum, and maximum values of the variable. It's very useful to mange and reviews the variables we working with.

      The Command History window as the name explains, it shows all the command and arguments we enter in the command window in case of we need to use it again or get a script selected lines of commands we used.
We can use the UP arrow in the keyboard to use the latest command line we used before.
      The Command Window shows everything happening in MATLAB and we use it to enter our inputs, equations, and commands.

Getting Help:

      MATLAB offers many basic ways to help you to get a better understanding about what you don't understand carefully, these ways are:
The help button which shows all the documentations of everything in MATLAB. 
 The help command, if we type "help" in the command window we will get all the topics available for help, or if we want to get help about a specific command we simply type "help command" then we will get the specific topic about the command we specify. 
 The Browse for Function button which can be found at the beginning of the prompt line in the command window, it shows all the functions commands of MATLAB and the usage instructions of each function with explanation and examples. 
 The command "type function_name" also returns the source code of the non-built-in MATLAB function called "function_name".
*** Some helping expressions:
Expression
Result
help help
discusses use of the help command.
help demos
lists names of various demo programs.
type linspace
lists the source code for the function which generates a vec-
tor of equidistant data values.
type plot
outputs a message indicating that plot is a built-in function.
intro
executes the source code in a function named intro which
illustrates various MATLAB functions.
type intro
lists the source code for the intro demo program.
graf2d
demonstrates X-Y graphing.
graf3d
demonstrates X-Y-Z graphing.
help diary
provides instructions on how results appearing on the command screen can be saved into a قle for later printing, editing, or merging with other text.
demo
initiates access to a lengthy set of programs demonstrating the functionality of MATLAB. It is also helpful to source list some of these programs such as: zerodemo, fitdemo, quaddemo, odedemo, ode45, fftdemo, and truss

* The next post is part 2 : Matlab Language Fundamentals  

DoWnLoaD this Tutorial as PDF 

No comments:

Post a Comment