MATLAB is a very important tool for every engineer but it plays a special role in the life of biomedical engineer so i decided to start up on MATLAB in a totally different fashion
First Steps in MATLAB
First of all officially “MATLAB is a software package that lets you do mathematics and computation, analyse data, develop algorithms, do simulation and modelling, and produce graphical displays and graphical user interfaces.”
GETTING STARTED IN MATLAB
- To run matlab on a PC double-click on the matlab icon.To run matlab on a unix system, type matlab at the prompt.
- To end a matlab session type quit or exit at the matlab prompt.
- You can type help at the matlab prompt, or pull down the Help
- menu on a PC.When starting matlab you should see a message: To get started, type one of these commands: helpwin,
helpdesk, or demo
>>
NOW HOW TO PERFORM FUNCTIONS IN MATLAB
ADDITION:
for adding two numbers just go to command prompt and
just type 1+1
and press enter you will get the output as 2 ; it is as simple as that.
MATLAB gives output as
ans =
2
This “ans” can be used also as a variable for the further operations.For example you can type
ans*ans
to check that 2 × 2=4
MATLAB has updated the value of ans to be 4.
Matrices’
The basic object that MATLAB deals with is a matrix. A matrix is an
array of numbers. For example the following are matrices:
The size of a matrix is the number of rows by the number of columns.
The ?rst matrix is a 3×3 matrix. The (2,3)-element is one million—1e6
stands for 1 × 106—and the (3,2)-element is pi = ? =3.14159 … .
The second matrix is a row-vector, the third matrix is a column-vector
containing the number i, which is a pre-de?ned matlab variable equal
to the square root of ?1. The last matrix is a 1 × 1 matrix, also called
a scalar.
Variables
Variables in matlab are named objects that are assigned using the
equals sign = .
They are limited to 31 characters and can contain
upper and lowercase letters, any number of ‘_’ characters, and numerals.
They may not start with a numeral. matlab is case sensitive: A
and a are di?erent variables. The following are valid matlab variable
assignments:
a=1
speed = 1500
name = ’biomedin’
invalid assignments:
2for1 = ’yes’
first one = 1
Please try this article if you like it i will post more