Consider the hot rod problem. Assume L=10m, h=0.01 m² and Ta= 20°C. dᎢ dx dz dx = Z =h(T-Ta) The boundary conditions are T(x = 0) = 40°C and T(x=L) = 200°C. Use a range of z values as your guesses to test in the loop. 1. In Matlab, input the right hand side of the ODEs as a function named RHS=@() _____ _____ ]- 2. Define x, and the initial condition (also as a matrix). One of the initial conditions will be a guess value of z(x = 0) = 5. 3. Use the ode45() command to evaluate the solution for the x range given. Plot the solution and check your boundary condition at the end. 4. Now add a loop that evaluates each value of zg given above, running ode45() each time. Create a matrix of test values where you subtract the calculated condition at x=L each time. Then use the min() command to find the best value of zg. 5. Run ode45() one last time. This time use the best value of zg and name your final solution "Tfinal" (should be the matrix output from ode45 that is two columns and includes both y1 and y2). Plot your final temperature and make sure it matches your expectations well. 1 % Constants L = 10; %m 3 h = 0.01; %m2 4 Ta = 20; %C 5 6 % To solve we need to guess a value of z 7 zg= linspace (5,15,10); 8 9 % x range |18|xin = 0:0.01:10; 11 12 13 % Set up the right hand side of the ODE as a matrix function 14 RHS = 15 16 % Set up a for loop to test each value of z. Don't forgot to change the initial condition inside the loop. 17 for i=1:length(zg) 18 19 end 20 21 % Find the best solution by looking at the minimium test value 22 23 bestz = %best value of z guess 24 25 % Re-run ODE45 with the best value of z 26 27 Tfinal - 28 29 30 % Plot to make sure the final solution matches the boundary conditions 31 32
Consider the hot rod problem. Assume L=10m, h=0.01 m² and Ta= 20°C. dᎢ dx dz dx = Z =h(T-Ta) The boundary conditions are T(x = 0) = 40°C and T(x=L) = 200°C. Use a range of z values as your guesses to test in the loop. 1. In Matlab, input the right hand side of the ODEs as a function named RHS=@() _____ _____ ]- 2. Define x, and the initial condition (also as a matrix). One of the initial conditions will be a guess value of z(x = 0) = 5. 3. Use the ode45() command to evaluate the solution for the x range given. Plot the solution and check your boundary condition at the end. 4. Now add a loop that evaluates each value of zg given above, running ode45() each time. Create a matrix of test values where you subtract the calculated condition at x=L each time. Then use the min() command to find the best value of zg. 5. Run ode45() one last time. This time use the best value of zg and name your final solution "Tfinal" (should be the matrix output from ode45 that is two columns and includes both y1 and y2). Plot your final temperature and make sure it matches your expectations well. 1 % Constants L = 10; %m 3 h = 0.01; %m2 4 Ta = 20; %C 5 6 % To solve we need to guess a value of z 7 zg= linspace (5,15,10); 8 9 % x range |18|xin = 0:0.01:10; 11 12 13 % Set up the right hand side of the ODE as a matrix function 14 RHS = 15 16 % Set up a for loop to test each value of z. Don't forgot to change the initial condition inside the loop. 17 for i=1:length(zg) 18 19 end 20 21 % Find the best solution by looking at the minimium test value 22 23 bestz = %best value of z guess 24 25 % Re-run ODE45 with the best value of z 26 27 Tfinal - 28 29 30 % Plot to make sure the final solution matches the boundary conditions 31 32
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
27.1
please complete the code
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 1 steps
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