You are on page 1of 8

Saint Louis University School of Engineering and Architecture Department of Electrical Engineering Baguio City

Activity #1 Introduction to MATLAB

Submitted to: Engr. Reggie G. Bustillo

June 20, 2013

Submitted by: Mahiwo, Godaliva D. Sol, Quennie B. Flores, James Jon

EE512L 5-8T (H511)

1. (Four decimal digits for the final answer) a)

>> format short >> 2^3+7^3+((273^3)/2)+55^(3/2) ans = 1.0174e+007 b)

>> (((3^7)*(log10(76)))/((7^3)+546))+(910^(1/3)) ans = 14.3174 c)

>> 43*((250^(1/4)+23)^2)/exp(45-3^3) ans = 4.7658e-004 d)

>>d1 (cos(5*pi/6)^2)*(sin(7*pi/8)^2)+((tan(pi*log(8))/6)/(7*(5/2))) ans = 0.1123

2. Define the variables x and z as x = 9.6, and z = 8.1, then evaluate: (Four decimal digits for the final answer)

>> x=9.6 x= 9.6000

>> ((443*z)/(2*(x^3)))+((exp(-x*z))/(x+z)) ans = 2.0279

>> z=8.1 z= 8.1000

>> y=x*(z^2) y= 629.8560

>> w=(2*z)/(3*x) w= 0.5625

>> y-(w^(3/5)) ans = 629.1479

3. A lateral edge of the frustum of a regular pyramid is 1.8 m long. The upper base is a square 1m by 1m and the lower base is 2.4m by 2.4m. Calculate (by writing one command) the volume of the frustum in cubic meters. Determine also the surface area of the frustum. (Three decimal digits for the final answer) >>format short g >>A1=1*1; >>A2=2.4*2.4; >>L1=1; >>L2=2.4; >>h=sqrt((1.8^2)+(0.7^2)); >>V=((A1+A2+sqrt(A1*A2))*(sqrt(373)/10))/3 V= 6.026 >>A=(1/2)*(L1+L2)*h A= 3.283

4. Determine the distance of the point (5,-3) from the line 7x4y-28 = 0. First define the variables A, B, C, x0 and y0, and then calculate d. (Use the abs and sqrt functions.) (Round answer to the nearest integer) >> A=7; >> B=-4; >> C=-28; >> x0=5; >> y0=-3;

>>D =(A*Xo)+(B*Yo)+C; >> E= sqrt(((abs(A))^2)+((abs(B))^2)); >> d=round(D/E)

d= 2

5. The magnitude M of an earthquake on the Ritcher scale is given by:

, where E is the energy released by the earthquake, and E0=104.4 Joules is a constant (energy of a small reference earthquake). Determine how many times more energy is released from an earthquake that registers 8.22 on the Ritcher scale than an earthquake that registers 4.33. (Two decimal digits for the final answer) >> format bank >> E0=10^4.4 E0 = 25118.86 >> M1=8.22;M2=4.33; >> E1=(E0)*(10^((3*M1)/2)) E1 = 53703179637025552.00 >> E2=(E0)*(10^((3*M2)/2)) E2 = 78523563461.01 >> E1/E2 ans = 683911.65

6. Define the following variables: table_price = $265.95 chair_price = $89.99 a) Evaluate the cost of two tables and eight chairs. b) The same as part a), but add 5.05% sale tax. c) The same as part b), but round the total cost to the nearest dollar. (Answers should be at best of 5 digit fixed) >> format short g >> table=265.95; >> chair=89.99; >> %a >> 2*table+8*chair ans = 1251.8 >> %b >> x=ans; >> x+.0505*x ans = 1315 >> %c >> round(ans) ans = 1315

7. Four circles are placed, as shown in the figure. At each point that two circles are in contact they are tangent to each other. Determine the distance between the centers C2 and C4. The radii of the circles are: R1=16 mm; R2=6.5 mm; R3=12 mm; R4=9.5 mm Display only the length of C2C4.

>> R1=16;R2=6.5;R3=12;R4=9.5; >> C1C2=R1+R2; >> C3C4=R4+R3; >> C2C3=R2+R3; >> C1C4=R1+R4; >> C1C3=R1+R3; >> beta1=acos((C1C4^2-C1C3^2-C3C4^2)/(-2*C1C3*C3C4))); >> beta2=acos((C1C2^2-C1C3^2-C2C3^2)/(-2*C1C3*C2C3))); >> C2C4=sqrt(C3C4^2+C2C3^2-(2*C3C4*C2C3*cos(beta1+beta2))); C2C4 = 33.5051

8. Flowers are packed in boxes such that a dozen are placed in each box. Determine how many boxes are needed to pack 751 flowers, using the ceil function. >> ceil(751/12) ans = 63

9. The balance B of a savings account after t years when a principal P is invested at an annual interest rate r and the interest is compounded n times a year is given by:

If the interest is compounded yearly, the balance is given by:

In one account $5,000 is invested for 17 years in an account where interest is compounded yearly. In a second account $5,000 is invested in an account which the interest is compounded monthly. In both accounts the interest rate is 8.5%. Use MATLAB to determine how long (in years and months) it would take for the balance in the second account to be the same as the balance of the first account in 17 years.

>> P=5000; >> r=0.085; >> t1=17; >> B1=P*(1+r)^t1; >> t=(log(B1/P))/(log(1+(r/12))); >> year=fix(196.4846/12) year = 16 >> months=ceil(12*.4846) months = 6

You might also like