FYSY115, spring 2016 EXERCISES 1 Return as an email attachment to taneli.kalvas@jyu.fi no later than 2 February at 12 o’clock noon. The email title should include FYSY115. If the exercises are made with a partner include the names of the team. Make each exercise to its own script file. 1. Calculate using Matlabilla: (a) 2 2×3 (b) 6 − 52 + 72 − 1 √ −3+2× 3 (c) 10 2 (d) 32 /4 (e) (32 )3 1 round( 96 2 sin( 3π ) 2 (f) 2 + (g) + 3 × 2) − 3 2. The cash register of the flea market has 1 20 e bill, 5 pcs 10 e and 6 pcs 5 e bills. I also has 10 pcs 2 e, 5 pcs 1 e, 4 pcs 50 c, 12 pcs 20 c, 7 pcs 10 c ja 21 pcs 5 c coins. Calculate the value. How should you write it on the script file so that checking the equation is as easy as possible. Use spaces and/or line changes. 3. Solve the roots of x2 − 3x + 1 using the quadratic formula x= −b ± √ b2 − 4ac . 2a Store results to variables x1 and x2. Matlabissa also has an internal function for solving polynomial roots. Find out the name of the function and use it to solve the polynomial. 4. Let us define column vectors x = [3 2 -6 8]’ ja y = [4 1 3 5]’. (a) Calculate the sum of vectors x and y. (b) Calculate the sum of vector x and scalar Y, where Y is the sum of the elements of vector y. (c) Calculate each of the elements of vector x raised to the power of the corresponding element of vector y (in other words, produce a vector with elements 34 , 21 , (−6)3 ja 85 ). 1 (d) Produce a vector z, containing the produces of the corresponding elements from vectors x and y. (e) Define scalar w as the sum of elements of vector z. (f) Calculate x’*y - w. Why is the result what it is? 5. Produce the following vectors. Start from :-operator. (a) 2, 4, 6, 8, . . . , 18, 20 (b) 10, 8, 6, 4, 2, 0, −2, −4 (c) 1, 1/2, 1/3, 1/4, 1/5, . . . , 1/19, 1/20 (d) 0, 1/2, 2/3, 3/4, 4/5, . . . , 19/5, 20/5 6. Produce a 100-element vector x with elements (−1)n+1 xn = , 2n − 1 where n = 1, ..., 100. 7. Vector x=1:0.2:2. Calculate the following operations: (a) ln(2 + x + x2 ) (b) ex (1 + cos(3x)) (c) cos2 (x) + sin2 (x) (d) tan−1 (x) (e) cot(x) (f) sec2 (x) + cot(x) − 1 8. Plot function tan(x) − x between x = [−5, 5]. Use a dense enough grid of points and adjust the plotting ranges to be suitable. 9. The intensity of sound through a concrete wall as a function of the distance is I(x) = I0 exp(−x/k), where I0 is the original intensity, x is distance and k = 0.01 m is the characteristic constant for the wall material and sound frequency. Make a graphical presentation of the situation between wall thicknesses 0 and 10 cm using linear scale in figure 1. The intensity of sound is often plotted on logarithmic scale as decibels. The decibel scale is defined as I(x) = 20 log10 exp(−x/k) IdB (x) = 20 log10 I0 Show the result in figure 2 using decibels. Name the axes of the plots. 2