Homework 1 Lectures 1 to 3

Homework 1 Lectures 1 to 3 - Homework 1 Lectures 1 – 3...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Homework 1 Lectures 1 – 3 Math 344 Ohio University Spring Quarter 09’‐10’ Bob Astrom (Astrom, Elbert) Math 344 Exercises 1.1 dB Correction for A-Weighted Sound Pressure Levels 40 35 30 25 20 dB 15 10 5 0 -5 10 2 10 Frequency (Hz) 3 10 4 Fundamentals of Acoustics 3rd Addition Page 281 Table 12.1 Math 344 Exercise 1.2 Graph of x+cox(x ) [-5: .1: 5] 6 5 4 2 0 Y -2 -4 -6 -5 -4 -3 -2 -1 0 X 1 2 3 4 5 The primary problem with the graph is that the number of data points in this graph are minimal compared to the resolution required to make a smooth graph. Increasing the number of points in the x vector will result in a more accurate depiction of the function. Graph on x+cos(x ) [-5: .001: 5] 6 5 4 2 0 Y -2 -4 -6 -5 -4 -3 -2 -1 0 X 1 2 3 4 5 Lecture 2 Homework Bob Astrom Code for Exercise 2.1 %l2p1 %Math 344 %Homework Problem 2.1 % or %Homework Lecture 2 Problem 1 ==> (l2p1) %Written by Bob Astrom % function y = c2p1(x) %name the function y = x.^2.* exp(-x.^2); %enter function Code for Exercise 2.2 %l2p2 %Math 344 %Homework Problem 2.2 % or %Homework Lecture 2 Problem 2 ==> (l2p2) %Written by Bob Astrom % %***Prints the curves for sin(nx); n=1 to 6*** %Setting limits from 0 to 2pi %Limit increments of pi/100 x = 0:pi/100:2*pi; %Calculate valuses of sine s1x = sin(x); s2x = sin(2*x); s3x = sin(3*x); s4x = sin(4*x); s5x = sin(5*x); s6x = sin(6*x); %Plot results on one graph plot(x,s1x,'blue',x,s2x,'black',x,s3x,'red',x,s4x,'green',x,s5x,'yellow',x,s6 x,'black') Math 344 Exercise 2.1 Graph of y = x * exp(-x ) 0.4 2 2 0.35 0.3 0.25 0.2 y 0.15 0.1 0.05 0 -5 -4 -3 -2 -1 0 x 1 2 3 4 5 Math 344 Exercise 2.2 Graph on sin(nx) n = 1 to 6 1 sin(x) sin(2x) sin(3x) sin(4x) sin(5x) sin(6x) 0.8 0.6 0.4 0.2 0 y -0.2 -0.4 -0.6 -0.8 -1 0pi pi/2 Pi sin(nx) 3pi/2 2pi Lecture 3 Homework Bob Astrom Exercise 3.1 By trial and error the lowest value of n is n = 24 with an answer of 1.475773161594552 Calculation by TI‐89 with the significant digits set at the maximum is 1.47577316159 Thus the answer given by MATLab is more accurate than the TI‐89 can display When the answer is input into the program the output contains 4 more significant digits and converges again after 7 more iterations. Code and Answers for Exercise 3.2 %l3p2 %Math 344 %Homework Problem 3.2 % or %Homework Lecture 2 Problem 2 ==> (l3p2) %Written by Bob Astrom % %***Returns the distance traveled by a ball after "n" bounces*** function distance = l3p2(n) % Solves for the total distance traveled after each cycle of the periodic motion % of a bouncing ball with a coefficient of elasticity of 0.9 by performing n iterations % of the equation with an initial height of 2 meters. % The program also outputs the distance the ball drops and height of the % return bounce. % % Input: "n" % The program requires the user to input "n" which is the number of bounces % to be calculater. % Output: "distance" % The programs outputs the distance traveled\after "n" iterations or bounces. % format long % prints more digits format compact % makes the output more compact height = 2; % set height equal to the initial distance of 2 meters. distance = 0; % Set the total height counter to 2 meters w drop = 0; % Set drop equal to 0 although this could be any number. bounce = 0; % Set bounce to 0 to start counter at 1. for i = 1:n % Loop set to users input of n bounces. bounce = bounce + 1 % counter to keep track of the number of bounces. drop = height % the distance of the drop is equal to the distance of the return % height in the previous cycle. height = height - .1*height % formula to calculate the height "height" after "n" bounces. distance = distance + drop + height distance. end % formula to calculate the total By trial and error it was determined that by the time n = 25 the distance the ball bounces begins to converge. By the time n = 50 the rate of change is within approximately 0.02 meters. Above this number of iterations the change is extremely minimal. The difference between n = 50 and n = 1000 is only 0.1956 meters. Math 344 Lecture 3 Homework Exercise 3.3 Bob Astrom The following graph contains data from hand calculations using Newton's Method. The data represents the error and percent error of the first three iteration The function under consideration is: f(x) = x^3 ‐ 4 Iteration X1 x2 x3 f'(x) = 2x^2 Value 1.6660 1.5911 1.5874 Error 0.0793 0.0037 0.0000 Percent Error 5.0 1.0 0.0 ...
View Full Document

Ask a homework question - tutors are online