You are on page 1of 2

# EM220 Name:

## MEC400 – Intro2Engr&Prob Solving

Faculty of Mechanical Engineering
Universiti Teknologi MARA SID:

## 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).

## >> 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 

## >> 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') 

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.

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.