Computer Application (Introduction To MATLAB)
Computer Application (Introduction To MATLAB)
1
Familiarization with Matlab Environment, Built-in Functions, Matrices and Plotting
1. Objective(s):
The activity aims to familiarize the students with matlab environment, built-in functions, matrices
and plotting.
2. Intended Learning Outcomes (ILOs):
The students shall be able to:
2.1 Get acquainted with matlab environment and its various features.
2.2 Understand the built-in functions of matlab.
2.3 Operate on the matrices.
2.4 Plot different graphs using matlab.
3. Discussion:
Matlab is a powerful language for technical computing. Its basic data element is matrix (array).It
can be used for math computations, modeling and simulations, data analysis and processing,
visualization and graphics, and algorithm development.
The standard Matlab program has tools (functions) that can be used to solve common problems.
The array is a fundamental form that Matlab uses to store and manipulate data. An array is a list
of numbers arrange in rows or in columns. The simplest array (one-dimensional) is a row, or a column of
numbers. A more complex array (two-dimensional) is a collection of numbers arranged in rows and
columns. One use of array is to store information and data, as in a table. In science and engineering,
one-dimensional arrays frequently represent vectors and two-dimensional arrays represent matrices.
Once variables are created in Matlab they can be used in a wide variety of mathematical
operations. Matlab is designed to carry out advanced array operations that have many applications in
science and engineering. Addition and subtraction are simple operations. The other basic operations,
multiplication, division and exponentiation can be done in Matlab in two different ways. One way, which
uses the standard symbols (*,/ and ^), follows the rules of linear algebra. The second way, which is called
element-by-element operations, uses the symbols .*,./ and .^ ( a period is typed in front of the standard
operation symbol).In both types of calculations, Matlab has left division operator (.\ or \).
4. Resources:
Matlab
5. Procedure:
1. Identify the different matlab windows and write its corresponding purpose.
2. Note the different symbols used in the command window and write its corresponding use.
3. Use matlab as a calculator and show the results in the accompanying table.
4. Note the different built-in functions and show the results in the accompanying table.
5. Evaluate the results after pressing the enter key for the assignment operator (=).
6. Evaluate the results after pressing the enter key for the creation of vectors (row vector and column
vector) from a known list of numbers, with constant spacing by specifying the first term, the spacing, and
the last term, with constant spacing by specifying the first and last terms,and the number of terms
7. Evaluate the results after pressing the enter key for the creation of two-dimensional array (matrix).
8. Evaluate the results after pressing the Enter key using colon (:) in addressing arrays.
9. Identify the different built-in functions for handling array and indicate its description and give an
example.
10. Evaluate the results after pressing the enter key that involves strings and strings as variables.
11. Evaluate the results after pressing the enter key that involves the operations of matrices.
12. Evaluate the values of x, y and z of the three equations three unknowns :
4x 2y + 6z = 8
2x + 8y + 2z = 4
6x + 10y + 3z = 0
13. Evaluate the results after pressing the enter key that involves element-element operations.
14. Identify the different built-in functions for analyzing arrays and indicate its description and give an
example.
1.
Window
Purpose
Command History
Command Window
View files, perform file operations such as open, find files and file
content, and manage and tune your files.
Editor
Figures
Help Browser
View and search the documentation and demos for all your
MathWorks products.
Variable Editor
Workspace Browser
Symbol
Purpose
{}
/\
()
2.
3.
Mathematical Expression
Result
>>(11+5)^4/3 * (7+3)^5/3
>>10^1.5
4.
Built-in Function
Result
>>sqrt(1430928237)
>>exp(143)
>>abs(-(-55.33))
>>log(110)
>>log10(1100)
>>factorial(100)
>>sind(90)
>>round(17/3+2^6)
>>rem(197,55)
>>sign(5)
5.
>>x= 11.45
>>x=55-40*x
>>a = 12
>>B= 20
>>a=12,B=20; C= (a+B)^2 +
(B/a)^5 * B^2
>>x = 1091279182;
6.
>>k = [4:2:20]
>>m = [2:0.05;10]
>>r=[0:5]
>>b = [13:-2:5]
>>a = linspace(2,1,4)
>>b=linspace(10,20,5)
>>c=linspace(20,5)
7.
>>b = [4 23 64 35 12
75 44 17 94 40
31 56 33 78 53]
>>cd = 6 ;e=4;h=3;
>>Ram=[e,cd*h,cos(pi/2);h^1/3,
sqrt(h*e/cd),4]
>>Z=
[1:3:13;5:5:25;linspace(5,50,5)]
>>zr=zeros(2,5)
>>on=ones(4,3)
>>we=eye(3)
>>aa=[3 6 9]
>>bb= aa'
>>B=[1 3 5 7; 1 2 3 4; 2 4 6 8]
>>C=B
>>D=[ 2 23 3 34 4 45 5 56]
>>E=D(2)
>>D(4)=55
>>D(3) + D(4)
>>D(3)^1/2 + D(4)^1/3
>>M=[1 4 7 9; 2 5 8 0; 3 6 9 2]
>>M(1,5)=11
>>M(2,3)-M(1,1)
8.
>> v=[12 22 13 33 14 44 15 55
16]
>>w=v(3:8)
>>Q=[2 5 7 9 1 3;
11 12 13 14 15 16;
25 37 74 53 22 19;
1 2 3 4 5 6; 31 50 92 82 38 25]
>>R=Q(:,6)
>>S=Q(3,:)
>>T=Q(1:3,:)
>>U=Q(2:5,1:2)
>>V=5:2:25
>>A=[8:2:2;ones(1,4);5:4:17;zeros(1,4)]
>>B=A([1,3],[2,3:4])
9.
Function
Description
length(v)
size(v)
reshape(v,9,1)
Example
diag(v)
When v is a vector of n
components, returns a
square matrix X of order
n+abs(k), with the
elements of v on the kth
diagonal. k = 0
diag(A)
10.
>>c(7)
>>c(7:21)
>>Info=char(Student Name:,Kharren
Rosario,Grade: A+)
11.
>>VecA=[ 2 4 6 ]; VecB=[ 15 30 45 ];
>>VecC= VecA + VecB
>>D= A + B
>>A=[1 2 3; 3 2 1; 2 4 6; 6 4 2];
>>B=[4 9 ; 3 1 ; 5 2];
>>C=A*B
>>D=B*A
>>I=G*F
>>AV=[ 3 6 ];BV=[1;3;4];
>>AV*BV
>>BV*AV
>>A*b
>>D=2*A
>>A*B
>>A*A^-1
12.
Rosario, Kharren Mae C.
Familiarization with Matlab Environment, Built-in Functions, Matrices and Plotting
>>Xb=inv(A)*B
>>D=[8 4 0]
>>Xc=D/C
13.
>>A=[4 2 9; 2 1 8]
>>B=[5 6 9; 7 4 0]
>>C=A.*B
>>D=A./B
>>E=B.^B
>>F=A*B
>>x=[3:7]
>>y=x.^1/2 + 4*x
>>x=[2:3:20]
>>x=[0:pi/4:pi]
>>y=cos(x)
14.
Function
Description
mean(A)
C=max(A)
(d,n)=max(A)
Incorrent statement
min(A)
Example
(d,n)=min(A)
sum(A)
sort(A)
Incorrect statement
median(A)
std(A)
det(A)
dot(a,b)
cross(a,b)
inv(A)
7. Conclusion:
Matlab is, indeed, a very convenient tool in technical computations. With the mere use of variables, it can solve
common problems in mathematics through arrays and matrices. It has various functions which performs different
operations that aid in solving mathematical expressions or statements.
8. Further Readings:
Ferraris, G. and Manenti, F. (2010). Interpolation and regression models for the chemical engineer:
solving numerical problems. Germany: Wiley-VCH Verlag
Filo, O. (2010). Information processing by biochemical systems: neural network type configurations.
New Jersey: Wiley.
Gopal, S. (2009). Bioinformatics: a computing perspective. India: McGraw-Hill Science/Engineering
Math.
Jaluria, Y. (2012). Computer methods for engineering with MATLAB applications (2nd ed.). Boca,
Rosario, Kharren Mae C.
Familiarization with Matlab Environment, Built-in Functions, Matrices and Plotting
____Sem SY ________
Unsatisfactory
Developing
Satisfactory
Very Satisfactory
1.
Apply
appropriate
techniques,
skills, and
modern tools to
perform a
disciplinespecific
engineering task.
Identifies modern
techniques but
fails to apply these
in performing
discipline-specific
engineering task.
Identifies modern
techniques and is
able to apply these
in performing
discipline-specific
engineering task.
Recognizes the
benefits and
constraints of
modern engineering
tools and shows
intention to apply
them for engineering
practice.
2.
Demonstrate
skills in applying
different
techniques and
modern tools to
solve
engineering
problems.
Attempts to apply
modern tools but
has difficulties to
solve engineering
problems.
Shows ability to
apply fundamental
procedures in using
modern tools when
solving engineering
problems.
Shows ability to
apply the most
appropriate and
effective modern
tools to solve
engineering
problems.
3.
Recognize the
benefits and
constraints of
modern
engineering
tools.
Recognizes some
benefits and
constraints of
modern
engineering tools.
Recognizes the
benefits and
constraints of
modern engineering
tools and shows
intention to apply
them for
engineering
practice.
Score
Total Score
Mean Score = (Total Score / 3)
Percentage Rating = (Total Score / 12) x 100%
Evaluated by:
______________________________________
Printed Name and Signature of Faculty Member
_______________
Date
CHEP 530D1
Computer Applications
in Chemical Engineering