
Elements Of Electromagnetics
7th Edition
ISBN: 9780190698614
Author: Sadiku, Matthew N. O.
Publisher: Oxford University Press
expand_more
expand_more
format_list_bulleted
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.
![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);](https://content.bartleby.com/qna-images/question/27c0385d-5521-4276-95c3-f5add10125cc/979b1275-f15d-48fd-89fb-38ef36f0ba6c/hcj5g2n_thumbnail.jpeg)
Transcribed Image Text: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);
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Similar questions
- I want to run the SGP4 propagator for the ISS (ID = 25544) I got from spacetrack.org in MATLAB. I don't know where to get the inputs of the function. Where do I get the inFile and outFile that is mentioned in the following function. % Purpose: % This program shows how a Matlab program can call the Astrodynamic Standard libraries to propagate % satellites to the requested time using SGP4 method. % % The program reads in user's input and output files. The program generates an % ephemeris of position and velocity for each satellite read in. In addition, the program % also generates other sets of orbital elements such as osculating Keplerian elements, % mean Keplerian elements, latitude/longitude/height/pos, and nodal period/apogee/perigee/pos. % Totally, the program prints results to five different output files. % % % Usage: Sgp4Prop(inFile, outFile) % inFile : File contains TLEs and 6P-Card (which controls start, stop times and step size) % outFile : Base name for five output files %…arrow_forwardUse matlab to solve the questionarrow_forwardPlease don't provide handwritten solution ......arrow_forward
- Can you help me code the algorithm into MATLAB? The delta zero, delta one and so forth are equal to the determinats of a 3x3 matrix made of the three vectors.arrow_forwardGiven the trasnfer function G(s) numerator and denominator coefficients for Matlab code should be: O s³+2s+1 2s4+2s²+1' the num= [1 0 2 1] and den=[2 020 1] O num=[1 2 1] and den=[2 0 2 1 1] O num=[1 2 1] and den=[2 2 1] O num=[1 0 2 1] and den=[2 2 0 1]arrow_forwardProblem 1 (15 points) (Core Course Outcome 5)/MatlabGrader Write a function mySecond Derivative Order 3 that calculates the second derivative d²y/dx² of a data set (x, y) with at least third order accuracy at each data point. The data is equidistant in x with spacing h. The function input shall be ⚫y: one-dimensional column vector of y values ⚫h: scalar value of spacing h The function output shall be • d2y: column vector of the same size as y containing d²y/dx² Calculate d²y/dx² using only the following formulas that use the nomenclature of Table 8-1 and the lecture notes, but are different from the formulas listed there: f" (xi) 164f(xi) — 465f(xi+1) + 460ƒ (xi+2) − 170ƒ (xi+3) + 11f (xi+5) + O(h³) = 60h2 56f(xi−1) − 105f(xi) +40f(xi+1) + 10f(xi+2) − f(x+4) + O(h³) 60h² −5f(xi−2) +80f(xi−1) − 150f(xi) + 80f(xi+1) − 5ƒ(xi+2) (1) f"(xi) = (2) f"(xi) = +0(h) (3) 60h2 f"(xi) -2f(x-4)+5f(xi-3)+50f(xi-1) — 110f(xi) +57f(xi+1) = +0(h³) (4) 60h² f"(xi) = 57f(x-5) 230f(xi-4) + 290 f (xi-3)-235…arrow_forward
- MATLAB...Hand written plzzzz asap....FAST PLZZZZZZZZZZZarrow_forwardConsider the following Initial Value Problem (IVP) dy /at = -t * sin (y); y(t = 0) =1 Solve for y(t=0.5) using a) Forward Euler method with At = 0.25. (Solve by hand) Develop a Matlab script that solves for y (t = 5) using Forward Euler method. Use the time step levels given below and plot t vs y in the same plot. Include the plot with the right format (axis labels, legends, ...) in your solution sheet and include your Matlab script in the solution as well. i) At = 0.25 ii) At = 0.125 b) Backward Euler method with At = 0.25 (Solve by hand)arrow_forwardPlease follow the instructions and the requirements according to the pictures above and I kinda need the solution quickly. The language of the code is in Matlab, thank you in advance.arrow_forward
- I am having trouble with the folloiwng MATLAB code. I am getting an error that says "unrecognized function or variable 'numericalPropogatorOptions". I have the aerospace toolbox and the aerospace blockset added. what add on do I have to download to use that function. How do I make this code work? % Define Keplerian Elements a = 29599.8; e = 0.0001; i = 0.9774; Omega = 1.3549; w = 0; M = 0.2645; [RECI, VECI] = Kepler2RV(a, e, i, Omega, w, M); initialState = [RECI * 1e3; VECI * 1e3]; % Initial position (m) and velocity (m/s) % Define constants mu = 3.986004418e14; % Gravitational constant (m^3/s^2) earthRadius = 6378.1363 * 1e3; % Earth radius in meters j2 = 1.08263e-3; % J2 perturbation coefficient % Define propagator options propOptions = numericalPropagatorOptions('CentralBody', 'Earth', ... 'GravitationalParameter', mu, ... 'InitialState', initialState, ... 'OutputTimeStep', 300); % Output every 300 seconds % Add perturbations addGravityModel(propOptions, 'Degree', 2,…arrow_forwardI am trying to find a Direction Cosine Matrix (DCM) for the Euler angle body 1-2-3 sequence. I tried making my own function and using the MATLAB function, but the result is a matrix that is transpose of each other. I mean that transpose(EA123toDCM) = E123toDCM. Why is that? Also, for the E123toDCM line, I am using the sequence 'ZYX'. Is that correct or should it be 'XYZ'? I know that that for a DCM of sequence 1-2-3 = R3(theta1)*R2(theta2)*R1(theta3). Is ZYX sequence the same as a 1-2-3 sequence? EA = [pi/3; -pi/4; -pi/6];EA123toDCM = EA123DCM(EA) E123toDCM = angle2dcm(EA(1,1), EA(2,1), EA(3,1), 'ZYX') function [R] = EA123DCM(EA) theta1 = EA(1,1); theta2 = EA(2,1); theta3 = EA(3,1); R1 = @(a)[1 0 0 ; 0 cos(a) -sin(a); 0 sin(a) cos(a)]; R2 = @(a)[cos(a) 0 sin(a) ; 0 1 0 ; -sin(a) 0 cos(a)]; R3 = @(a)[ cos(a) -sin(a) 0; sin(a) cos(a) 0;…arrow_forwardI am trying to find a Direction Cosine Matrix (DCM) for the Euler angle body 1-2-3 sequence. I tried making my own function and using the MATLAB function, but the result is matrices that are not equal to each other. But, if I were to use the 'ZYX' sequence, I would get a matrix that is equal to the transpose of the matrix produced by my function.I mean that transpose(EA123toDCM) = E123toDCM if I changed the sequence to 'ZYX'. I never got two equal matrices. Can you fix my code so I would get two equal DCM matrices for the body 1-2-3 sequence? Also, for the E123toDCM line, I am using the sequence 'XYZ'. Is that correct or should it be 'ZYX'? I know that that for a DCM of sequence 1-2-3 = R3(theta1)*R2(theta2)*R1(theta3). Is ZYX sequence the same as a 1-2-3 sequence? EA = [pi/3; -pi/4; -pi/6];EA123toDCM = EA123DCM(EA) E123toDCM = angle2dcm(EA(1,1), EA(2,1), EA(3,1), 'XYZ') function [R] = EA123DCM(EA) theta1 = EA(1,1); theta2 = EA(2,1); theta3 = EA(3,1); R1 =…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Elements Of ElectromagneticsMechanical EngineeringISBN:9780190698614Author:Sadiku, Matthew N. O.Publisher:Oxford University PressMechanics of Materials (10th Edition)Mechanical EngineeringISBN:9780134319650Author:Russell C. HibbelerPublisher:PEARSONThermodynamics: An Engineering ApproachMechanical EngineeringISBN:9781259822674Author:Yunus A. Cengel Dr., Michael A. BolesPublisher:McGraw-Hill Education
- Control Systems EngineeringMechanical EngineeringISBN:9781118170519Author:Norman S. NisePublisher:WILEYMechanics of Materials (MindTap Course List)Mechanical EngineeringISBN:9781337093347Author:Barry J. Goodno, James M. GerePublisher:Cengage LearningEngineering Mechanics: StaticsMechanical EngineeringISBN:9781118807330Author:James L. Meriam, L. G. Kraige, J. N. BoltonPublisher:WILEY

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