Probability and Statistics: Dr. Faisal Bukhari Punjab University College of Information Technology (Pucit)
Probability and Statistics: Dr. Faisal Bukhari Punjab University College of Information Technology (Pucit)
B=[10 ; 2]
figure
pie(x, labels)
Reference: http://en.wikipedia.org/wiki/MATLAB
In 2004, MATLAB had around one million users across industry and
academia[3]. MATLAB users come from various backgrounds of
engineering, science, and economics. MATLAB is widely used in
academic and research institutions as well as industrial enterprises.
Reference: http://en.wikipedia.org/wiki/MATLAB
MATLAB spits out the answer to our query conveniently named ans.
This is a variable or symbolic name that can be used to represent the
value later.
>> x=5*6
x = 30
Dr. Faisal Bukhari, PUCIT, PU 15
Command Window and Basic Arithmetic [2]
Once a variable has been entered into the system, we can refer to it
later. Suppose that we want to compute a new quantity that we’ll call y,
which is equal to x multiplied by 3.56. Then we type
>> y = x * 3.56
y = 106.8000
or equivalently:
x = [3 ; 2 ; 1]
Dr. Faisal Bukhari, PUCIT, PU 19
Two-dimensional arrays:
Format: A = [row1 ; row2 ; ... ; rowN] an array with N rows.
Entry of arrays begins with a left square bracket, [ , and ends with a
right square bracket, ].
2 3 4
-5 4 2
4 -3 5
1 3 4
-5 54 2
4 -3 15
2 2 -9
2 3 4
-5 4 2
4 -3 5
1 3 4
-5 54 2
4 -3 15
2 2 -9
Dr. Faisal Bukhari, PUCIT, PU 24
Revision of array elements:
Revision of array elements: Assignment: change a single element.
Note: the use of the colon (wild card) in arrays, : , means to use all
elements of a specified row or column.
A= 2 3 4
-5 4 2
2 3 4 4 -3 5
-5 4 17
4 -3 5
A= Recall
A=
2 3 4 2 3 4
-5 4 17 -5 4 17
1 23 8 4 -3 5
Recall
A=
A=
2 3 4
2 4 4 -5 4 17
-5 6 17 1 23 8
1 -14 8
1 2
3 4
D=
1 2 3 4
E=
1/6 1/7
1/7 1/8
1/8 1/9
Columns 4 through 6
1/5 1/6 1/7
1/6 1/7 1/8
1/7 1/8 1/9