0% found this document useful (0 votes)
11 views4 pages

tutorial Matlab

The document outlines a tutorial for the Tools and Numerical Methods for Engineering course at the University of Buea, detailing various exercises involving MATLAB. Exercises include evaluating mathematical expressions, finding vector magnitudes, solving equations, and plotting functions. Additionally, it covers matrix operations, logical statements, and MATLAB syntax for various commands.

Uploaded by

obenakum1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

tutorial Matlab

The document outlines a tutorial for the Tools and Numerical Methods for Engineering course at the University of Buea, detailing various exercises involving MATLAB. Exercises include evaluating mathematical expressions, finding vector magnitudes, solving equations, and plotting functions. Additionally, it covers matrix operations, logical statements, and MATLAB syntax for various commands.

Uploaded by

obenakum1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

University of Buea/ Faculty of Engineering and Technology

Tutorial: Tools and Numerical Methods for Engineering (CEF 352)


Course Instructors: Dr WATI and Dr AZEUFACK

Exercise 1
a) Use Matlab to evaluate

3 9 3 9  11 8 7 1.25
5    ; 43   ; 5 ; 5 3 ; 9
4 5  4  2  3  14 3

b) Find de volume of a sphere of radius 2m


     
c) Create a Matlab m file to display the results of sin   , sin   , sin   as rational
4 3 2
numbers.
Exercise 2
a) Find the magnitude of the vector A = (-1 7 3 2)
b) Find the magnitude of the vector A= (-1+i 7i 3 -2-2i)
c) Consider the number 1, 2, 3. Enter these as components of column vector and as
components of a row vector
d) Given A= [1; 2;3]; B= [4; 5; 6]; find the array product of the two vectors
e) What command would create a 5  5 matrix with ones on the diagonal and zeros everywhere
else?
 8 7 11   2 1 2
   
f) Consider the two matrices A   6 5 1  , B   1 6 4  and compute their array
 0 2 8   2 2 2
   
product and matrix product
g) Find a solution to the following set of equations:
x  2 y  3z  12
4 x  y  2 z  13
9 y  8 z  1
What is the determinant of the coefficient matrix?

Page 1 of 4
Exercise 3
Complete the table
Number Mantissa-exponent MATLAB form
789.34
1  10 4
4
4e11

Exercise 4

a- Write 3432.6 in exponent-mantissa form and write 100  1010 in normal form
 x cos x 
b- Construct the function y  x   sin  2  for values of x from one to three in steps
 x  3x  1 
0.02.
c- Plot the quadratic x 2  7 x  3 from x equals -3 to 3 in steps of 0.2
Exercise 5

a- Use MATLAB to solve 3 x 2  2 x  7


b- Find the solution of the system:
x  3y  2 y  6
2 x  4 y  3z  8
3 x  6 y  8 z  5
Exercise 6
a- We use MATLAB to solve an equation 2x+3=0. What is the correct function to call and
what is the syntax?
b- We use MATLAB to solve an equation 2x+3=1. What is the correct function to call and
what is the syntax?
c- Find the roots of x 2  5 x  9  0
d- You want to plot a curve as a dashed blue line. The correct command is:
1) Plot(x, y, ‘b-‘)
2) Plot(x, y, ‘b_’)
3) Plot(x, y, ‘b’, ‘-‘)
e- To plot a curve as a red dotted line, what is the correct command?
f- If A is a column vector, we can create the transpose or row vector B by writing:
1) B=transpose(A)
2) B=A’
3) B=t(A)
4) B=trans(A)
g- When writing MATLAB code, to indicate the logical possibility of a NOT EQUAL b in an
If statement you write:
1) a !=b
Page 2 of 4
2) a.NE.b
3) a<>b
4) a~=b
h- The OR operator in MATLAB code is represented by
1) The .OR. keyword
2) Typing and between variables
3) Typing~between variables
4) The “pipe” character
g- To enter the elements 1 -2 3 7 in a column vector, we type:

1) 1: 2 : 3 : 7
2) 1, 2,3, 7
3) 1; 2;3;7
4) 1  237 
h-To compute the square of a vector f of data, write:
1) sqr(f)
2) f . 2
3) f  2
4) Square (f)
i- To implement a for loop which ranges over 1  x  5 in increments of 0.5 the best command is:
1- for i=1, 5, 0.5
2- for i=1:0.5:5
3- for loop i=1, 5, 0.5
4- loop i=1:0.5:5 do

j- A function y  e 2 x is defined numerically for some data range x. It can be entered using:

1) y  exp   x   exp   x 
2) y  sqr  exp   x  
3) y  exp   x  .  exp   x 
4) y  sqrt  exp   x  
k- To find the largest value in a column vector x, type:
1) max(x)
2) maximum (x)
3) largest (x)
l- To plot a log-log plot, the correct command is:
1) Plot (x, y, ‘log-log’)
2) loglog (x, y)
3) log (x, y)

Page 3 of 4
4) logplot (x, y)
Exercise 6
1- Find the inverse of the matrix:
1 2
A 
2 1
2- By calculating the matrix inverse of the coefficient matrix, solve the system:
x  2y  4
3x  4 y  7
3- Find the rank of the matrix:
 1 2 4 
 
 3 2 5 
1 2 8 
 
4- Find the inverse of the matrix in the previous problem.

Page 4 of 4

You might also like