K 0.05 G 9.81 T 3 F G / K (T + (Exp (-0.05 T) - 1) /K)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Taif University Introduction to

Faculty of Engineering Computer Programming


Electrical Engineering Dept. 8031101-3
Fall 2019 Exercise Sheet #2 - Answer

1. Write MATLAB commands to solve each of the following problems:

𝑔 𝑒 −0.05𝑡 −1
a. Find the value of the expression (𝑡 + ), where 𝑘 = 0.05,
𝑘 𝑘

𝑔 = 9.81 and 𝑡 = 3
k=0.05; g=9.81; t=3;
f = g / k * (t +(exp(-0.05*t)-1)/k)

b. Find the average of two numbers 𝑥1 = 7 and 𝑥2 = 19.


x1=7; x2=19;
a = (x1+x2)/2

c. Find the average of a set of five numbers {9,12,23,44,57}


x=[9 12 23 44 57];
a = mean(x)
OR
a = mean( [9 12 23 44 57] )

d. Calculate the area of a circle of radius is 3.5 𝑚


r=3.5;
a = pi*r^2

e. Calculate how long it takes a car traveling at a given uniform speed of


120 𝑘𝑚/ℎ𝑜𝑢𝑟 to travel a distance of 450 𝑘𝑚.
v=120; d=450;
t=d/v

2. Use MATLAB help to find suitable built-in functions and write MATLAB
commands to perform the following tasks:

1
a. Find the absolute (positive) value of −5
abs(-5)

b. Approximate the number 9.25 to the nearest integer.


round(9.25)

c. Find the remainder of dividing 517 by 7


rem(517, 7)

d. Calculate the time 𝑡 taken by a particle to hit the ground if it was


stationary at height 𝑑 = 100 𝑚 and started falling freely under
1
gravitational acceleration of 𝑔 = 9.8 𝑚/𝑠 2 (Hint 𝑑 = 𝑔 𝑡 2 )
2

d = 100; g = 9.8;
t = sqrt(2*d/g)

You might also like