You are on page 1of 7

Numerical Methods Lab.

GENG 300

Lab Report # 2
Section: Tuesday - Evening

Group No.

1. Name of the Student: Jamal Adel Hannun


Student ID: 201300283

Lab. Instructor: Sikder Md Selimuzzaman

Fall 2015

Numerical Methods Lab.

GENG 300

Assignment 2
A2-1. Plot t versus v with line width 1.5, dotted, red
colored line, triangle shaped, marker with size 10,
black edge, and green face.
>> t=0:2:20; m=68.1; cd=0.25;
>> g=9.81;
>> v=sqrt(g*m/cd)*tanh(sqrt(g*cd/m)*t);
>> plot(t,v)
>> hold on
>> plot(t,v, 'o')
>> hold off
>> title ('Plot of v versus t')
>> xlabel('Values of t')
>> ylabel('Values of v')
>> grid
>> plot (t,v, ':^r', 'Linewidth', 1.5, 'MarkerSize' , 10, 'MarkerEdgeColor', 'k', 'MarkerFaceColor', 'g')

A2-2. a. Determine the drag coefficient (cd) using the equation: = 2 from the exploratory

data analysis below: g=9.81


Mass, m
measured velocity, v

83.6
53.4

60.2
48.5

72.1
50.9

91.1 92.9 65.3


55.9 54
47.7

Hints: m= [83.6

60.2

72.1

91.1

92.9

65.3

>> m= [83.6 60.2

72.1

91.1

92.9

65.3

80.9]

80.9
51.1

80.9]

m=

Columns 1 through 5

Lab. Instructor: Sikder Md Selimuzzaman

Fall 2015

Numerical Methods Lab.

GENG 300

83.6000 60.2000 72.1000 91.1000 92.9000

Columns 6 through 7

65.3000 80.9000

>> v=[53.4 48.5 50.9 55.9 54 47.7 51.1]

v=

Columns 1 through 5

53.4000 48.5000 50.9000 55.9000 54.0000

Columns 6 through 7

47.7000 51.1000

>> g=9.81; cd = g*m./v.^2

cd =

Lab. Instructor: Sikder Md Selimuzzaman

Fall 2015

Numerical Methods Lab.

GENG 300

Columns 1 through 5

0.2876

0.2511

0.2730

0.2860

0.3125

Columns 6 through 7

0.2815

0.3039

b. Find out average, maximum, and minimum of cd by the command mean(cd), max(cd),
and min(cd) respectively.
>> mean(cd)

ans =

0.2851

>> max(cd)

ans =

0.3125

>> min(cd)

ans =

Lab. Instructor: Sikder Md Selimuzzaman

Fall 2015

Numerical Methods Lab.

GENG 300

0.2511

c. Determine the predicted terminal velocity by the equation, = , where


cdavg=mean(cd).

>> cdavg=mean(cd)

cdavg =

0.2851

>> pred=sqrt(g*m/cdavg)

pred =

Columns 1 through 5

53.6342 45.5131 49.8088 55.9883 56.5388

Columns 6 through 7

47.4018 52.7610

Lab. Instructor: Sikder Md Selimuzzaman

Fall 2015

Numerical Methods Lab.

GENG 300

d. Plot measured velocity (v) vs. predicted terminal


velocity (vpred) in the top half of a figure with circle
shaped and drag coefficient (cd) vs. mass (m) in the
bottom half with diamond shaped using subplot.
>> subplot(2,1,1);plot(v,pred,'o')
>> subplot(2,1,2);plot(cd,m,'d')
A2-3. Using M-files (script and function files), execute the
following statements for determining F:
= ( + )
F= the future worth, P= amount of money invested, $100,000, i=interest rate, 0.06, n= number
of years, 7
p=10;
i=0.06;
n=7;
F = p*(1+i)^n

>> F
F =
15.0363
function F = future( p,i,n )
%UNTITLED10 Summary of this function goes here
%
Detailed explanation goes here
F=p*(1+i)^n
end

>> future(100000,0.06,7)
F =
1.5036e+05
ans =
1.5036e+05

A2-4. Using input and disp function, find out the value of Future worth (F) of A2-3 (use only script
file)

Lab. Instructor: Sikder Md Selimuzzaman

Fall 2015

Numerical Methods Lab.

GENG 300

p=input('Money ($): ');


i=input('Interest rate: ');
n=input('Years: ');
disp(' ');
disp('Future worth (F): ');
disp(p*(1+i)^n)

Money ($): 100000


Interest rate: 0.06
Years: 7
Future worth (F):
1.5036e+05

A2-5. Rearrange mass (m) and Velocity (v) of A2-2 in two columns as appropriate using fprintf
function.
function mv
m=[83.6 60.2 72.1 91.1 92.9 65.3 80.9];
v=[53.4 48.5 50.9 55.9 54 47.7 51.1];
z=[m;v];
fprintf(' mass
velocity\n');
fprintf('%7.2f %7.2f\n',z);
end

>> mv
mass velocity
83.60 53.40
60.20 48.50
72.10 50.90
91.10 55.90
92.90 54.00
65.30 47.70
80.90 51.10

Lab. Instructor: Sikder Md Selimuzzaman

Fall 2015

You might also like