Problem 1/MatlabGrader (15 points, CCO #8) Develop a Matlab function myRK3 that performs a single step of a third-order Runge-Kutta method for the ODE dy dx = f(x, y). The RK coefficients are given in the following so-called Butcher tableau using the variable names from the text book/lecture 0 1/2 1/2 a1 a2 b21 аз b31 b32 C1 C2 C3 3/4 0 3/4 2/9 1/3 4/9 (1) (2) As input the function shall take the function f, the current independent variable xi and dependent variable yi corresponding to the current solution point (xi, yi) and the step size h. As output the function shall give the new independent variable x and dependent variable y corresponding to the new solution point (x+1, Yi+1). Note, to pass the Matlab Grader tests, you must use global kl k2 k3 slope; inside your function and use these variable names for the respective components of the RK method. Remove this global statement after submission to Matlab Grader for the following problems. Required submission: ☐ well commented function source code submitted to Matlab Grader Problem 2/MatlabGrader (10 points) A water tank of radius R with two outlet pipes of radius r₁ and r2 installed at heights h₁ and h₂ is mounted in an elevator moving up and down causing a time dependent acceleration see Fig. 1. g(t)goa, cos(2π fgt), R 1 H Figure 1: Water tank inside an elevator The height of water h(t) in the tank can be modeled by the following ODE, where dh dt (3) f(t)-p√2g(t) (r√✓√max(0, h − h₁) + r√//max (0, h - h2) PTR² (4) f(t)=c[2+ sin (2π fit + cos(2π f2t))] (5) models the inflow into the tank. Note that the cos is within the sin in f(t). Write a Matlab function myRHSE8 that takes as input the current time t and height h and returns the scalar value rhs of the right-hand-side of Eq. (4). Use global variables for all parameters used in the right-hand-side, i.e., for go, ag, fg, p, R, r₁, r2, h1, h2, c, f1, f2 use go, ag, fg, rho, R, rl, r2, h1, h2, c, f1, and £2, respectively. The max appearing in Eq. (4) is returning the larger of the 2 scalar argument values and is implemented in Matlab as the max function, e.g., max(0, h - h₁) is simply max (0,h-h1). Required submission: ☐ well commented function source code submitted to Matlab Grader Problem 3/MatlabGrader (10 points, CCO #8) For the case described in problem 2 with go = 9.81m/s², ag = 4m/s², fg = 0.0017Hz, p = 1000kg/m³, R = 1.8m, r1 = 0.09m, r2 = 0.04m, h₁ = 0.13m, h₂ = 0.2m, c = 31 kg/s, f₁ = 0.013Hz, and f2 = 0.024Hz, calculate the height of water in the tank at t=2500s using the third-order Runge-Kutta method of Problem 1 with a step size of At = 10s if the initial height of water in the tank is 0.35m. Store the value of the height of water in the tank at t=2500s in the scalar variable answer. In your script, define all the above given parameters as global variables. MatlabGrader will provide working copies of both my RK3 and myRHSE8 so these do not need to be part of your MatlabGrader submission for this problem. Required submission: ☐ well commented script source code submitted to Matlab Grader Problem 4 (25 points, CCOs #1 & #8) For the case described in problems 2 and 3, calculate the height of water in the tank at t =2500s to within 10-7m using either the third-order Runge-Kutta method of Problem 1, or, for a 10 point deduction, the classical RK-4 method. Outside of your code, report the method you have chosen to solve this problem, the final step size At employed and all supporting evidence that your result has the required accuracy. Note that for full credit it is not sufficient to only show that the estimated error is below the requested threshold, but you must also show that your chosen method converges as expected. Report h(t =2500s) as a floating point number in engineering notation with at least 10 mantissa digits. Required submission: Name of RK method chosen (including this name in code is not sufficient) h(t=2500s) (at least 10 digits reported), employed At, and all supporting evidence ☐ printout of any new functions coded that were not part of previous exams/homework; printout of script used to solve this problem (can be a combined script);
Problem 1/MatlabGrader (15 points, CCO #8) Develop a Matlab function myRK3 that performs a single step of a third-order Runge-Kutta method for the ODE dy dx = f(x, y). The RK coefficients are given in the following so-called Butcher tableau using the variable names from the text book/lecture 0 1/2 1/2 a1 a2 b21 аз b31 b32 C1 C2 C3 3/4 0 3/4 2/9 1/3 4/9 (1) (2) As input the function shall take the function f, the current independent variable xi and dependent variable yi corresponding to the current solution point (xi, yi) and the step size h. As output the function shall give the new independent variable x and dependent variable y corresponding to the new solution point (x+1, Yi+1). Note, to pass the Matlab Grader tests, you must use global kl k2 k3 slope; inside your function and use these variable names for the respective components of the RK method. Remove this global statement after submission to Matlab Grader for the following problems. Required submission: ☐ well commented function source code submitted to Matlab Grader Problem 2/MatlabGrader (10 points) A water tank of radius R with two outlet pipes of radius r₁ and r2 installed at heights h₁ and h₂ is mounted in an elevator moving up and down causing a time dependent acceleration see Fig. 1. g(t)goa, cos(2π fgt), R 1 H Figure 1: Water tank inside an elevator The height of water h(t) in the tank can be modeled by the following ODE, where dh dt (3) f(t)-p√2g(t) (r√✓√max(0, h − h₁) + r√//max (0, h - h2) PTR² (4) f(t)=c[2+ sin (2π fit + cos(2π f2t))] (5) models the inflow into the tank. Note that the cos is within the sin in f(t). Write a Matlab function myRHSE8 that takes as input the current time t and height h and returns the scalar value rhs of the right-hand-side of Eq. (4). Use global variables for all parameters used in the right-hand-side, i.e., for go, ag, fg, p, R, r₁, r2, h1, h2, c, f1, f2 use go, ag, fg, rho, R, rl, r2, h1, h2, c, f1, and £2, respectively. The max appearing in Eq. (4) is returning the larger of the 2 scalar argument values and is implemented in Matlab as the max function, e.g., max(0, h - h₁) is simply max (0,h-h1). Required submission: ☐ well commented function source code submitted to Matlab Grader Problem 3/MatlabGrader (10 points, CCO #8) For the case described in problem 2 with go = 9.81m/s², ag = 4m/s², fg = 0.0017Hz, p = 1000kg/m³, R = 1.8m, r1 = 0.09m, r2 = 0.04m, h₁ = 0.13m, h₂ = 0.2m, c = 31 kg/s, f₁ = 0.013Hz, and f2 = 0.024Hz, calculate the height of water in the tank at t=2500s using the third-order Runge-Kutta method of Problem 1 with a step size of At = 10s if the initial height of water in the tank is 0.35m. Store the value of the height of water in the tank at t=2500s in the scalar variable answer. In your script, define all the above given parameters as global variables. MatlabGrader will provide working copies of both my RK3 and myRHSE8 so these do not need to be part of your MatlabGrader submission for this problem. Required submission: ☐ well commented script source code submitted to Matlab Grader Problem 4 (25 points, CCOs #1 & #8) For the case described in problems 2 and 3, calculate the height of water in the tank at t =2500s to within 10-7m using either the third-order Runge-Kutta method of Problem 1, or, for a 10 point deduction, the classical RK-4 method. Outside of your code, report the method you have chosen to solve this problem, the final step size At employed and all supporting evidence that your result has the required accuracy. Note that for full credit it is not sufficient to only show that the estimated error is below the requested threshold, but you must also show that your chosen method converges as expected. Report h(t =2500s) as a floating point number in engineering notation with at least 10 mantissa digits. Required submission: Name of RK method chosen (including this name in code is not sufficient) h(t=2500s) (at least 10 digits reported), employed At, and all supporting evidence ☐ printout of any new functions coded that were not part of previous exams/homework; printout of script used to solve this problem (can be a combined script);
Elements Of Electromagnetics
7th Edition
ISBN:9780190698614
Author:Sadiku, Matthew N. O.
Publisher:Sadiku, Matthew N. O.
ChapterMA: Math Assessment
Section: Chapter Questions
Problem 1.1MA
Related questions
Question
If you can please take a look, I struggled with figuring out problem 2, 4, , and 6. Please let me know if you have any solutions.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images
Recommended textbooks for you
Elements Of Electromagnetics
Mechanical Engineering
ISBN:
9780190698614
Author:
Sadiku, Matthew N. O.
Publisher:
Oxford University Press
Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:
9780134319650
Author:
Russell C. Hibbeler
Publisher:
PEARSON
Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:
9781259822674
Author:
Yunus A. Cengel Dr., Michael A. Boles
Publisher:
McGraw-Hill Education
Elements Of Electromagnetics
Mechanical Engineering
ISBN:
9780190698614
Author:
Sadiku, Matthew N. O.
Publisher:
Oxford University Press
Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:
9780134319650
Author:
Russell C. Hibbeler
Publisher:
PEARSON
Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:
9781259822674
Author:
Yunus A. Cengel Dr., Michael A. Boles
Publisher:
McGraw-Hill Education
Control Systems Engineering
Mechanical Engineering
ISBN:
9781118170519
Author:
Norman S. Nise
Publisher:
WILEY
Mechanics of Materials (MindTap Course List)
Mechanical Engineering
ISBN:
9781337093347
Author:
Barry J. Goodno, James M. Gere
Publisher:
Cengage Learning
Engineering Mechanics: Statics
Mechanical Engineering
ISBN:
9781118807330
Author:
James L. Meriam, L. G. Kraige, J. N. Bolton
Publisher:
WILEY