Docsity

CVEN 302-501 Homework: Matlab Programming in Engineering and Construction, Assignments of Civil Engineering

Toggle sidebar
bg1
CVEN 302-501
Computer Applications in Engineering and Construction
Homework #2 Matlab Programming 1
Date distributed : 1.23.2006
Date due : 1.30.2006 at 5:00 pm
Return your solution either in class or in my mail box (WERC Rm. 235H) by the date shown
above. Please show all your work and follow the rules outlined in the course syllabus.
1 Order of Operations
Write Matlab commands based on the standard order of operations using +-*/^()
and the functions pi,exp,sqrt,log, and sin to evaluate the following expressions. Trust
the order of operations rules and use a minimum number of parentheses. Use the Matlab
interactive session to evaluate your expressions and use a hand-held calculator to check your
results. Take the following parameter values when checking your results.
a= 15 b=ฯ€
c= exp (1) d=โˆš2
t= 0.0125
(1)
Example: y=12โˆ’a
bsin2(c)
Answer: y = (12 - a)/b * sin(c)^2 evaluates in Matlab to y = -0.1611.
Hand calculation agrees with Matlab.
1. x= 3a2+ 2bโˆšcโˆ’d1/a
2. s=bโˆ’c
aโˆ’d
3. r=1
1โˆ’ln (a
c)+1
d
4. w= 25sin (at2)
5. z=โˆ’(ab)2+(cโˆ’d)โˆ’1
c
t+โˆšโˆ’ln t
CIVIL College Station, Texas 77843-31363136 TAMU (979) 845-4517 FAX (979) 862-8162
pf2

Partial preview of the text

Download CVEN 302-501 Homework: Matlab Programming in Engineering and Construction and more Assignments Civil Engineering in PDF only on Docsity!

CVEN 302-

Computer Applications in Engineering and Construction Homework #2 Matlab Programming 1

Date distributed : 1.23. Date due : 1.30.2006 at 5:00 pm

Return your solution either in class or in my mail box (WERC Rm. 235H) by the date shown above. Please show all your work and follow the rules outlined in the course syllabus.

1 Order of Operations

Write Matlab commands based on the standard order of operations using + - * / ^ () and the functions pi, exp, sqrt, log, and sin to evaluate the following expressions. Trust the order of operations rules and use a minimum number of parentheses. Use the Matlab interactive session to evaluate your expressions and use a hand-held calculator to check your results. Take the following parameter values when checking your results.

a = 15 b = ฯ€ c = exp (1) d =

t = 0. 0125

Example: y = (^12) bโˆ’ asin^2 (c) Answer: y = (12 - a)/b * sin(c)^2 evaluates in Matlab to y = -0.1611. Hand calculation agrees with Matlab.

  1. x = 3a^2 + 2b

c โˆ’ d^1 /a

  1. s = (^) abโˆ’โˆ’cd
  2. r = (^1) โˆ’ln (^) (^1 a c )+^1 d
  3. w = 2^5 sin (at^2 )
  4. z = โˆ’(ab)

(^2) +(cโˆ’d)โˆ’ 1 c t +โˆšโˆ’ ln t

CIVIL 3136 TAMU College Station, Texas 77843-3136 (979) 845-4517 FAX (979) 862-

2 Problems from Chapra (2005) Chapter 1

Do problem 1.10 on page 14 in Chapra (2005). Show all your work by hand.

3 Problems from Chapra (2005) Chapter 2

Do problems 2.3, 2.4, and 2.6 on page 29 in Chapra (2005). Do the Matlab calculations either within a Matlab .m-file or a diary file. Turn in a copy of the file you create. For problem 2.6, turn in a copy of the graph as well. For each problem, use the minimum number of parentheses that are necessary. Do problem 2.8 on page 30 in Chapra (2005). Turn in a copy of your Matlab commands (diary of .m-file) and a print-out of the graph. Note that you can use hold on between two plotting commands in order to plot the second set of data on top of the first. Recall for all these problems that when you are manipulating vector data element-by- element, you must use the dot-operators: (.*, ./, and .^, and that addition, subtraction, and built-in Matlab functions do not require any special treatment.

References

Chapra, S. C. (2005), Applied Numerical Methods with MATLAB for Engineers and Scien- tists, First edn, McGraw Hill, Boston.