Documents Found!
As seen in
Less Work, Better Grades
Join
Course Hero
Access
best resources
Ace
your classes
Ace your courses with Course Hero!
|
|
|
Study Smarter, Score Higher
Here are the top 5 related documents
...Course Outline-MAE 5 Quantitative Computer Skills Fall Quarter: September 25 to December 12, 2008
Times and places: Lecture: A00 TuTh 8 -9:20 am, Center Hall 214; Lab. Sects. EBU2 205: A01 Tu 9:30-11, A02 W 10-11:50, A03 W 1-2:50, A04 Th 11-1:25, A05...
...True BASIC is the Ideal First Step
by Thomas E. Kurtz
Co-inventor or BASIC
Thomas E. Kurtz & the late John G. Kemeny invented BASIC in 1963 for use in their math and computer science courses at Dartmouth College, in Hanover, NH. 35 years later it re...
.../* MAE 9: Homework #1, Fall 2008 Due on Monday, October 6, Turnin time from 9:00am-9:00pm Write a C program (hw1.c) that: A. prints on the terminal screen a sentence: "I am writing my first C program." Print this sentence three times, each time in a ...
.../* MAE 9: Homework #2, Fall 2008 Due on Monday, October 13, Turnin from 9:00am - 9:00pm Compute the area (A) and the volume (V) of a sphere with radius R=0.1, R=0.2, R=0.3, . , R=1.5 . Compute also the total area (TA) and the total volume (TV) of all...
Document Content (unformatted)
Course Hero has millions of student submitted documents similar to the one
below including study guides, homework solutions, papers, exam answer keys and textbook solutions.
#9 Homework PROBLEM 1. (15 points) Consider the initial value problem: y = 2t 2 - y , y (0) = -1 (1) The exact solution is y (t ) = -5exp(-t ) + 2t 2 - 4t + 4 (2) The objective here is to test various numerical methods for computing the solutions of ordinary differential equations in terms of their efficiency in obtaining an accurate solution. Implement each of the following numerical methods in Matlab to solve (1) with a uniform step size h and obtain y(0.5) accurate to 4 decimal places. a. Explicit Euler b. Modified Euler predictorcorrector c. Fourthorder RungeKutta Which of these methods is most efficient (i.e., requires the fewest evaluations of the righthand side of (1)) ? Solution: Transforming the procedures of examples 20.1, 20.2 and 20.3 into a MATLAB code, the solution of the problem is presented as following: % % % % % % % % % % % MAE 107 S2007, homework 9, problem 1 Exact solution to double precision accuracy y(0.5) = -0.532653298563167 Exact solution to 4 decimal digit accuracy y(0.5) = -0.5326 Euler Method y(0.5) = -0.5326 function evaluations = 512 Modified Euler Method y(0.5) = -0.5326 function evaluations = 64 4th-Order Runge-Kutta Method y(0.5) = -0.5326 function evaluations = 8 function [] = hw9_prob1() clc;clear; % Solution for hw9, problem #1 % integration interval [a b] a = 0; b = 0.5; % initial condition y0 = -1; % number of decimal digit accuracy required Nd = 4; %********************************************* % the exact solution evaluated at t = b format long; yexact = -5*exp(-b) + 2*b^2 - 4*b + 4; disp([char(10) 'Exact solution to double precision accuracy']) disp(['y(' num2str(b) ') = ' num2str(yexact,15)]) yexact = fixdec(yexact,Nd); disp(['Exact solution to ' num2str(Nd) ' decimal digit accuracy']) disp(['y(' num2str(b) ') = ' num2str(yexact,Nd)]) %********************************************* % the explicit Euler method h = 2*(b - a); err = 1; while err > 0 h = h/2; [t, y] = odeEuler(@hw9_prob1_ODE,a,b,h,y0); tN = t(length(t)); yN = fixdec(y(length(t)),Nd); err = abs(yN - yexact); end disp([char(10) 'Euler Method']) disp(['y(' num2str(tN) ') = ' num2str(yN,Nd)]) N = (b - a)/h; % number of steps Nf = N; % number of function evaluations disp(['function evaluations = ', num2str(Nf)]) %********************************************** % the modified Euler method h = 2*(b - a); err = 1; while err > 0 h = h/2; [t, y] = odeModEuler(@hw9_prob1_ODE,a,b,h,y0); tN = t(length(t)); yN = fixdec(y(length(t)),Nd); err = abs(yN - yexact); end disp([char(10) 'Modified Euler Method']) disp(['y(' num2str(tN) ') = ' num2str(yN,Nd)]) N = (b - a)/h; % number of steps Nf = 2*N; % number of function evaluations disp(['function evaluations = ', num2str(Nf)]) %************************************************ % the 4th-order Runge-Kutta method h = 2*(b - a); err = 1; while err > 0 h = h/2; end disp([char(10) '4th-Order Runge-Kutta Method']) disp(['y(' num2str(tN) ') = ' num2str(yN,Nd)]) N = (b - a)/h; % number of steps Nf = 4*N; % number of function evaluations disp(['function evaluations = ', num2str(Nf)]) end function y = fixdec(x,n) % fix to specified number of decimals input: % x = array to be fixed n = integer number of decimals (scalar) % output: % y = x fixed to n decimals f = 10^n; y = fix(x*f)/f; end function dydt = hw9_prob1_ODE(t,y) dydt = 2*t.^2 - y; end function [x, y] = odeEuler(dydx,a,b,h,y0) % odeEuler solves a first order initial value ODE using Euler's explicit % method. Input variables: dydx Name of a function file that calculates % dy/dx. a The first value of x. b The last value of x. h % Step size. y0 The value of the solution y at the first point (initial % value. Output variable: x A vector with the x coordinate the of % solution points. y A vector with the y coordinate of the solution % points. x(1) = a; y(1) = y0; N = (b-a)/h; for i = 1:N x(i+1) = x(i) + h; y(i+1) = y(i) + dydx(x(i),y(i))*h; end end function [x, y] = odeModEuler(dydx,a,b,h,y0) % odeModEuler solves a first order initial value ODE using the modified % Euler method. Input variables: dydx Name of a function file that % calculates dy/dx. a The first value of x. b The last value of % x. h Step size. y0 The value of the solution y at the first % point (initial value. Output variable: x A vector with the x % coordinate of the solution points. y A vector with the y coordinate % of the solution points. x(1) = a; y(1) = y0; N = (b-a)/h; for i = 1:N [t, y] = odeRK4(@hw9_prob1_ODE,a,b,h,y0); tN = t(length(t)); yN = fixdec(y(length(t)),Nd); err = abs(yN - yexact); x(i+1) = x(i) + h; slope0 = dydx(x(i),y(i)); y1 = y(i) + slope0*h; slope1 = dydx(x(i+1),y1); y(i+1) = y(i) + (slope0 + slope1)*h/2; end end function [x, y] = odeRK4(dydx,a,b,h,y0) % odeRK4 solves a first order initial value ODE using Ronge-Kutta fourth % order method. Input variables: dydx Name of a function file that % calculates dy/dx. a The first value of x. b The last value of % x. h Step size. y0 The value of the solution y at the first % point (initial value). Output variable: x A vector with the x % coordinate of the solution points. y A vector with the y coordinate % of the solution points. x(1) = a; y(1) = y0; n = (b-a)/h; for i = 1:n x(i+1) = x(i) + h; K1 = dydx(x(i),y(i)); xhalf = x(i) + h/2; yK1 = y(i) + K1*h/2; K2 = dydx(xhalf,yK1); yK2 = y(i) + K2*h/2; K3 = dydx(xhalf,yK2); yK3 = y(i) + K3*h; K4 = dydx(x(i+1),yK3); y(i+1) = y(i) + (K1 + 2*K2 + 2*K3 + K4)*h/6; end end Output: Exact solution to double precision accuracy y(0.5) = 0.532653298563167 Exact solution to 4 decimal digit accuracy y(0.5) = 0.5326 Euler Method y(0.5) = 0.5326 function evaluations = 512 Modified Euler Method y(0.5) = 0.5326 function evaluations = 64 4thOrder RungeKutta Method y(0.5) = 0.5326 function evaluations = 8 >> It is clear that the RungeKutta method is more efficient in terms of minimum number of RHS function evaluations. PROBLEM 2. (15 points) A flexible cable of uniform density is suspended between two points. The shape of the cable, y(x), is governed by the differential equation: d y dy =C 1 2 dx dx 2 where C is a constant equal to the ratio of the weight per unit length of the cable to the magnitude of the horizontal component of tension in the cable at its lowest point. The cable hangs between two points specified by y(0) = 15m and y(20) = 10m, and C = 0.041 m1. Use Matlab's builtin functions ode45 and fzero to devise a shooting method to determine the shape of the cable between x = 0 and x = 20m. Solution: % MAE 107 Spring 2007 % main function to compute shape of flexible cable with appropriate % boundary conditions satisfied function hw9_prob2 clear; close all; clc % setup constants and parameters C = 0.041; xl = 0; xr = 20; yl = 15; yr = 10; % subfunction describing shape of the cable function [dy] = cable_func(x, y) dy = [ y(2); C * sqrt(1 + y(2).^2) ]; end % subfunction to compute residual of boundary value of y at x = xr function resid = newton_func(y_dash_init) y_init = [yl; y_dash_init]; [X, Y] = ode45(@cable_func, [xl xr], y_init); resid = Y(end,1) yr; end % compute that value of y_dash at x = xl for which residual vanishes y_dash_init = fzero(@newton_func, 0); 2 fprintf('The value of dy/dx at x = %8.6f, is %8.6f\n\n', xl, y_dash_init) % plot the shape of the cable y_init = [yl; y_dash_init]; [X, Y] = ode45(@cable_func, [xl xr], y_init); plot(X, Y(:,1)); title('Shape of flexible cable'); end Output: The value of dy/dx at x = 0.000000, is 0.697719
Find millions of documents here - Study Guides, Homework Solutions, Papers, Exam Answer Keys and more.
Course Hero has millions of course related materials that will enable you to learn better,
faster and get an A in all your courses.
Below is a small sample set of documents:
Below is a small sample set of documents:
UCSD >> MAE >> 107 (Spring, 2008)
%Problem1: This program call the function LU to calculate the LU %decomposition of the matrix A clc;clear; A=[10 2 -1; 2; 5]; % Calling the lu_decomp function % Defining A -3 -6 1 1 [L1,U1]=lu_decomp(A); disp(\'Calculated L1 = \');disp(L1); disp(\'Ca...
UCSD >> MAE >> 107 (Spring, 2008)
MAE 107 Spring 2007 HW 6 Problem 1 Contents Plot data Linear regression Flow for x = 120 Plot data clear; close all; clc % Store data in (x,y) x = [88.9 108.5 104.1 139.7 127 94 116.8 99.1] y = [14.6 16.7 15.3 23.2 19.5 16.1 18.1 16.6] % Sort data ...
UCSD >> MAE >> 107 (Spring, 2008)
Homework 8 solution 17.4 (a) Analytical integration yields: -2 1-x -4x 32x 5 dx=[ x- 4 x2 2 -x 4 x6 3 4 ] =1104 -2 (b) Single application of the Trapezoidal rule gives: -291789 =5280 2 4-2 (c) Composite Trapezoidal rule ...
UCSD >> MAE >> 107 (Spring, 2008)
MAE 107 Spring 2007 HW 7 Problem 1 This code interpolates the given data for the conductivity-temperature function, and evaluates this function at x = 4. Contents Setup (a) Forward Difference Table (b) Construct Newton-Gregory Polynomial (c) Using Di...
UCSD >> MAE >> 107 (Spring, 2008)
MAE 107 Computational Methods in Engineering Spring 2007 Homework #3 Solutions Problem 2: Problem 7.12 on page 184 of the textbook. As shown in section 7.2.1 in the textbook, the maximum error En after n iterations is E n = (2 - )x ( n ) In which ...
UCSD >> MAE >> 107 (Spring, 2008)
MAE 107 Computational Methods in Engineering Spring 2007 Homework #2 Solutions Problem 1: Problem 4.7 on page 110 of the textbook. The function (correcting a typographical error in the text) f ( x) = has the derivative f ( x) = ( 1 1 - 3x 2 ) (1...
UCSD >> MAE >> 107 (Spring, 2008)
MAE 107 Spring 2007 HW 4 Problem 1 Contents The terms can be collected to give: The terms can be collected to give: A = [0 -7 5;0 4 7;-4 3 -7] b = [50;-30;40] x = A\\b AT = A\' AI = inv(A) % transpose % inverse A = 0 0 -4 -7 4 3 5 7 -7 b = 50 -30 ...
Rhodes >> BUS >> 243 (Spring, 2008)
...
Rhodes >> RELS >> 102 (Spring, 2008)
...
Rhodes >> RELS >> 102 (Spring, 2008)
...
Rhodes >> RELS >> 102 (Spring, 2008)
...
Rhodes >> RELS >> 102 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> CALC >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
* This is exam 1 from Spring 2007. Be aware that material covered by our first exam may be different - we have covered some things that they did not, and they covered some things that we did not, at the same point in the quarter. Problems for materia...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
Exam Two MATH 200 Spring, 2007 WARNING! This exam is being provided as a study aid. However, be aware that the syllabus for Math 200 Spring 2008 is a little different from the syllabus from Spring 2007. So the exams for this year will cover somewh...
Drexel >> PHYS >> 102 (Spring, 2008)
PHYS-102 Homework 3 Solutions Spring-08 _ Chapter 20 Electric Potential and Capacitance 1,11,27 P20.1 (a) Energy of the proton-field system is conserved as the proton moves from high to low potential, which can be defined for this problem as moving f...
Drexel >> PHYS >> 102 (Spring, 2008)
Exam Three MATH 200 Spring, 2008 Total Pg 1 (20 pts) Pg 2 (25 pts) Pg 3 (25 pts) Pg 4 (20 pts) Pg 5 (10 pts) Pg 6 (4 pts) Name_ Section_ Show all your work on the exam paper, legibly and in detail, to receive full credit. No Calculators. 1. Co...
Drexel >> PHYS >> 102 (Spring, 2008)
Consider the current in the length of wire shown in Figure 22.24. Rank the points A, B, and C, in terms of magnitude of the magnetic field due to the current in the length element shown, from greatest to least. 1. 2. 3. A>B>C B>C>A C>A>B 33% 33% ...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
Exam Three MATH 200 Spring, 2007 Name_ Section_ Show all your work on the exam paper, legibly and in detail, to receive full credit. No Calculators. Page 1) _ 2) _ 3) _ 4) _ 5) _ 6) _ Total 1. (20 points) Use the appropriate form of the multi-d...
Drexel >> PHYS >> 102 (Spring, 2008)
AC Generators Electric generators take in energy by work and transfer it out by electrical transmission The AC generator consists of a loop of wire rotated by some external means in a magnetic field 1 Induced emf In an AC Generator The induced emf ...
Drexel >> PHYS >> 102 (Spring, 2008)
OUTLINE OF SOLUTIONS PHYS-102 SPRING-08 QUIZ-III Time Limit: 50 min. NOTE: For Prob.1, below, please circle the answer of your choice for each part. 1a. Two wires each of length, L are made of the same material of electrical resistivity and have u...
Drexel >> PHYS >> 102 (Spring, 2008)
PHYS-102 Homework 4 Solutions Spring-08 _ Chapter 20 Electric Potential and Capacitance 41, 49, 69 1 1 1 = + Cs 15.0 3.00 Cs = 2.50 F Cp = 2.50 + 6.00 = 8.50 F ! $ 1 1 Ceq = # + \" 8.50 F 20.0 F & % (b) \'1 P20.41 (a) = 5.96 F Q = C!V = ( 5.96...
Drexel >> PHYS >> 102 (Spring, 2008)
PHYS-102 Homework 2 Solutions Spring 06/07 _ Chapter 19 Electric Forces and Electric Fields P19.31 A = ! r 2 = ! ( 0.200 ) = 0.126 m 2 2 !E = EA cos \" 5.20 ! 105 = E ( 0.126 ) cos 0 E = 4.14 ! 106 N C = 4.14 MN C P19.36 # ! mg = qE = q %...
Drexel >> PHYS >> 102 (Spring, 2008)
PHYS-102 Homework 5 Solutions Spring-08 _ Chapter 21 Current and Direct Current Circuits 25, 29, 31 P21.25 (a) P= (V )2 R 20.0 W = becomes so (b) (11.6 V )2 R R = 6.73 . FIG. P21.25 V = IR so and 11.6 V = I (6.73 ) I = 1.72 A e = IR + Ir s...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> PHYS >> 102 (Spring, 2008)
Ampere\'s Law Ampere\'s Law r r states that the line integral of B ds around any closed r path ds equals oI where I is the total steady current passing through any surface bounded by the closed path r r B ds r r B ds = o I Ampere\'s Law, cont Amp...
Drexel >> CALC >> 200 (Spring, 2008)
> term1:=(u2*v3-u3*v2)^2+(u3*v1-u1*v3)^2+(u1*v2-u2*v1)^2; > term2:=(u1^2+u2^2+u3^2)*(v1^2+v2^2+v3^2)-(u1*v1+u2*v2+u3*v3)^2; > term1 - term2; > expand(%); ...
Drexel >> PHYS >> 102 (Spring, 2008)
Faraday\'s Law of Induction This is generally expressed as: an induced emf is produced in the secondary circuit by the changing magnetic field The actual existence of the magnetic field is not sufficient to produce the induced emf, the field must be c...
Drexel >> CALC >> 200 (Spring, 2008)
...
Drexel >> CALC >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> CALC >> 200 (Spring, 2008)
...
Drexel >> PHYS >> 102 (Spring, 2008)
PHYS-102 Homework 1 Solutions Spring 06/07 _ Chapter 19 Electric Forces and Electric Fields P19.7 (a) The force is one of attraction . The distance r in Coulomb\'s law is the distance between centers. The magnitude of the force is F= . (b) ke q1 ...
Drexel >> PHYS >> 102 (Spring, 2008)
PHYS-102 SPRING-08 QUIZ-II Time Limit: 50 min. Recitation Sec.#_ _ Name_ Notes:1. For problems 2 and 3, your solutions must have adequate details to get full credit. kQ1Q2 r2 U = kQ1Q2/r ; V = kQ/r ; F = qE F= 1/40 = k = 9 x109 Nm 2C !2 1/C ...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> PHYS >> 102 (Spring, 2008)
PHYS-102 QUIZ-I SOLUTION SPRING-08 Time allowed: 50 min. Notes: 1. For Prob.1 please circle the answer of your choice for each part. 2. For problems 2 and 3, your solutions must have adequate details to get full credit. __ Name (Please PRINT) _ _ r ...
Drexel >> CALC >> 200 (Spring, 2008)
...
Drexel >> CALC >> 200 (Spring, 2008)
...
Drexel >> CALC >> 200 (Spring, 2008)
...
Drexel >> CALC >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> MATH >> 200 (Spring, 2008)
...
Drexel >> PHYS >> 102 (Spring, 2008)
Problem 22.54. Assume that the region to the right of a certain vertical plane contains a vertical magnetic field of magnitude 1.00 mT and that the field is zero in the region to the left of the plane. An electron, originally traveling perpendicular ...
What are you waiting for?