Sie sind auf Seite 1von 11

MATLAB and LabVIEW

Chapter 1
Introduction to MATLAB

Nguyen Huu Cuong, PhD.


• MATLAB (MATrix LABorator) is a special-purpose computer program
optimized to perform engineering and scientific calculators.
• The MATLAB program implements the MATLAB programming language
and provides a very extensive library of predefined functions to make
technical programming tasks easier and more efficient.
• There are more thanh 1000 functions in the basic MATLAB product, and
the toolkits extend this capability with many more functions in various
specialties.
The Advantages of MATLAB
1. Easy to use
2. Platform independence
3. Predefined functions
4. Device-independent plotting
5. Graphical user interface
6. MATLAB compiler
Disadvantages of MATLAB
• MATLAB has two principal disadvantages:
• Interpreted language – therefore may execute more slowly than
compiled languages.
• Cost – a full copy of MATLAB is five or ten times more expensive
than a conventional C or Fortran compiler.
The MATLAB Environment
• The fundamental unit of data in any MATLAB program is the array.
• Scalars are treated as array – they are simply arrays with only one row
and one column.
• Three most important types of windows:
• Command Windows
• Edit Windows
• Figure Windows
The MATLAB Desktop
Current Folder shows This control allow a MATLAB Lauch the
a list of the files in user to view or change Command Help
the current folder the current folder Window Browser

Workspace
Browser shows
variables defined
in workspace

Command
History window
displays previous
commands

Editor window
used to create or
modify M-files
The Figure Window
The Workspace Browser
Array Editor allows the user to
Workspace Browser shows a list the
edit any variable or array selected
variables defined in the workspace
in the Workspace Browser
Getting Help

help sin

lookfor inverse
A Few Important Commands

To run MATLAB’s built-in demonstrations


demo

To clear contents of the Command Window


clc

To clear contents of the current Figure Window


clf

To clear variables on the workspace


clear

If an M-file appears to be running for too long, it may contain a infinite loop
and it will never terminate. Typing Ctrl + C.
Notes
• MATLAB checks for variable names first, so if you define a variable with
the same name as a function or command, that function or command
becomes inaccessible.
• Never create an M-file with the same name as a function or command.
• Special symbols
+ Addition
- Subtraction
* Multiplication
/ Division
^ Exponentiation

Das könnte Ihnen auch gefallen