You are on page 1of 2

EM220 Name:

MEC400 – Intro2Engr&Prob Solving


Faculty of Mechanical Engineering
Universiti Teknologi MARA SID:

LABORATORY ASSIGNMENT NO. 1 Due: / /17

Title: Introduction to MATLAB

Learning Outcomes: Upon completion of this assignment, students must be able to use
MATLAB to
(1) compute simple arithmetic operations
(2) perform matrix operations
(3) plot the functions of a single variable.

PROBLEM STATEMENT (70 marks)

a) Repeat and perform the following operations (the symbol  means ‘press enter’):

>> A = 2; 
>> B = 3; C = 4; 
>> D = A + B  and see the result.
>> E = A^3 + B^A  and see the result.
>> F = 2*C + sqrt(C) – 1  and see the result.
>> sqrt(F) , sqrt(– F)  and see the result.
>> clear all  (this instruction erases all previously defined variables from the memory).

b) Perform the following operations:

>> A = [ 1 0 1; –3 2 –1; 4 1 0]  and see the result.


>> B = 2*A, C = B – A  and see the result.
>> % To determine the determinant and inverse of a matrix, types in the followings: 
>> det(A)  and see the result.
>> inv(A)  and see the result.
>> clear all 

c) Repeat and perform the following operations:

>> t = 0 : 0.1 : 3*pi; 


>> % This defines the array of t from 0 to 3*pi with an increment of 0.01 
>> K = 1; Fo = 10; 
>> zeta = 0.140; wn = 5; phi = atan(sqrt(1 – zeta^2)/zeta); 
>> y1 = exp(– zeta*wn*t)/sqrt(1 – zeta^2); 
>> y2 = K*Fo*(1 – y1.*sin(wn*sqrt(1 – zeta^2)*t + phi)); 
>> plot(t, y2); grid 
>> xlabel(‘Time, t (s)’) ; ylabel(‘Functions of y(t), m’,’Fontsize”, 20) 
>> title('Plot of Step Response of 2nd-order dynamics system') 

Note: Please exercise your common sense and innovativeness when completing this
assignment!!!
General requirements of the assignment:
1) Document your work appropriately with name, SID and your filename on every page at the
upper or bottom right-hand corner.
2) Write in your own words an introduction and a problem statement, have comments or
explanation on important steps and discussion of results, and etc.
3) Start the new problem on the new page and have a cover page for your report.

Prepared by: Zamri A.R. My Document/KJM497/Lab/A1_Matlab 1/2


MEC 400 

Lab 1: Matlab Basics

Objective
The objective of this assignment is to ensure that all students are capable of using Matlab to
perform numerical calculations and present data and results in printed and plotted form. A
plot will be transferred to a word processor for the purpose of writing a lab report.

Reported Individually
This lab is to be done independently by each student, and each student is to submit his or her
own lab report.

1. Log into your computer, and ensure that you can run Matlab and MS Word.
2. Obtain this document from the UiTM’s i-Learn web site and open it in MS Word.
3. Using Matlab, work through each of the problems.
4. The resulting document becomes your lab report.
5. The reports are due by 10:00 AM on __________, ___________ in the IN-side of my
lecturer’s document box in front of my office at A18-10A, Tower 1, S&T Complex.
Each student is required to do this lab individually.  No credit will be given  for a group of two or more lab
reports in which, in the instructors’ judgment, the results are not sufficiently individually obtained.

Prepared by: Zamri A.R. My Document/KJM497/Lab/A1_Matlab 2/2