You are on page 1of 4

BTECH MECHANICAL ENGINEERING IMI

BME 357 MATLAB for ENGINEERS

Answer ALL Questions


Use the Matlab program for all questions
Please MATLab Command codes have been provided as an attachment
format
Program in the Matlab Window, present results in word or ipeg or any acceptable

Q1
a. The combined resistance RT of four resistors in parallel is given by
1
R =1,L
R1 R2 R3 R4

where R, R2, R3, and R4 are the resistances of the four resistors. A combination of
resistances values is referred for comparison todetermine which set will provide the
maximum and minimum values for shunt applications.
I. RË = 12l, Rz = 5 2, Rg = 25 ), R4 = 15 2
I. R = 10 l, R, =8 , R3 = 22 2, R4 = 18n
III. R, = 14 n, R, 42, Ra =27 N, Ra = 10 2
IV. R, = 16 N, R, =3N, Ra = 22 2, Ra = 12 2

Develop a programme to determine the R for I to IV and determine the


maximum andminimum values for the combined resistances Rr.
(15marks)

Q2
11 -2 3
12
Let A = 4 0 4 B=
-6 2
1 9 5

-3 2
[5 -2
D= E= 1 3 5 7 6 8 0 9 4 2] F= 1 4
7 6 -5
I. Determine the product matrix AB, and state it size
II. Writea command to arrange the element of the vector E in ascending order.
III. Write a command multiply F and C. Obtain the flip left toright
IV. Reshape D to a six by onc matrix
V. Solve for X in AX = Bclearly writing out the MATLAB code (10 marks)
DO NOT WRITE ON THE QUESTION PAPER
Q3

a. Use Matlab to create a script file of the following functions in intervals of

4=3sin(2t) e i+2
Y2 =3 sin(2t) + 2
4
Y: =3 e t+2
Ya = 0.02t + 3

Plot a separate graph for each function such that 0<ts30, for intervals of
-0.0001. Include titles, axis plotted on a grid background
II. Complete a multigraph plot of the four functions such that 0 < t s 30,for
intervals of 0.0001. Create legends and colour codes to discriminate the plots.
Include titles, axis plotted on a grid background.
III. Determine from the plots, truth set of the following equations
t
a. y1 3sin(2t).e 5+2
Y2 =3sin(2t) + 2
and B. y3 = 3e s +2
Y4 = 0.02t + 3

(15 marks)

b.
Create the x and y vectors such that
x=-pito pi,intervals 0.1, y=-pito pi, intervals 0.1
Use meshgrid to create matrices,
[X, Y] = meshgrid (x, y):
Obtain Z = sin(X) cos(Y), note that Z is a matrix.
I. Obtain a Three D SURF of X, Y and Z.
II. Statethe minimum value ofZ,
(10 marks)
Give MATLABcommands to plot, on the same figure, the two functions:
f=3t2+ 2t - 0.5
=2tcos(t)
Where the variable t varies from 0to 10 with step 0.005

Draw the function f in blue 0andthe function g in red *


II. Give a title toyour graph and label the axes of plot (10 Marks)
MATLAB Meaning
Command
clear Clear workspace
clf Clear current figure.
computer Type of computer
c2d Conversion of continuous-time models to discrete-time i
abs Absolute values, complex magnitude
det Determinant
diag Diagonal matrix
eig Eigenvalues and eigenvectors
exp Exponential base e
eye Identity matrix
grid on Adds major grid linesto thecurrent axes
legend Graph legend
length Length of vector
linspace Linearly spaced vector
log10 Log base 10
xlabel X-axis label

ylabel y-axislabel
zeros Zeros array
MATLAB Command Meaning
max
Maximum value
mean
Mean value
Median value
median
Three-dimensional mesh surface
mesh
Xand Y arrays for three dimensional plots
meshgrid

You might also like