I'm sorry, I cannot fulfill that request.
Added by Sherri D.
Close
Step 1
Is it due to limitations, constraints, or other factors? Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 56 other Physics 103 educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
(a) Write an M-file named myrk4.m, in the style of ode23tx.m, that implements the classical Runge–Kutta fixed step size algorithm. Instead of an optional fourth argument rtol or opts, the required fourth argument should be the step size h. Here is the proposed preamble. % function [tout,yout] = myrk4(F,tspan,y0,h,varargin) % MYRK4 Classical fourth-order Runge–Kutta. % Usage is the same as ODE23TX except the fourth % argument is a fixed step size h. % MYRK4(F,TSPAN,YO,H) with TSPAN = [TO TF] integrates % the system of differential equations y' = f(t,y) % from t = TO to t = TF. The initial condition % is y(TO) = YO. % With no output arguments, MYRK4 plots the solution. % With two output arguments, [T,Y] = MYRK4(..) returns % T and Y so that Y(:,k) is the approximate solution at % T(k). More than four input arguments, % MYRK4(..,P1,P2,..), are passed on to F, % F(T,Y,P1,P2,...). (b) Roughly, how should the error behave if the step size h for classical Runge–Kutta is cut in half? (Hint: Why is there a —4— in the name of myrk4?) Run an experiment to illustrate this behavior. (c) If you integrate the simple harmonic oscillator ÿ = -y over one full period, 0 ≤ t ≤ 2̀, you can compare the initial and final values of y to get a measure of the global accuracy. If you use your myrk4 with a step size h = ̀/50, you should find that it takes 100 steps and computes a result with an error of about 10^-6. Compare this with the number of steps required by ode23, ode45, and ode113 if the relative tolerance is set to 10^-6 and the refinement level is set to one. This is a problem with a very smooth solution, so you should find that ode23 requires more steps, while ode45 and ode113 require fewer.
Akash M.
2. (1.3 mark) Write a Matlab code for solving the diffusion equation numerically using the pdepe() Matlab pde solver, with initial condition u(x, t = 0) = x(1 - x), D = 1 and homogeneous Dirichlet boundary condition u(x = 0, t) = u(x = 1, t) = 0 (i.e. the diffusing particles reaching either end of the domain are permanently eliminated). Plot the solution u(x, t) at four representative time points (e.g t = 0, 0.1, 0.2, 0.3), comparing it graphically with the truncated series solution using three nonzero terms. Submit your matlab code and figure showing your results. [Matlab: For using the pdepe() solver read carefully the matlab help page. Note, that the first example given at the end is a matlab code for solving the heat/diffusion equation, which you can use for this assignment with small modifications. Change the value of the diffusion coefficient to D = 1. Change the initial condition. Change the boundary condition. The number of points used in both space (x) and time (t) for the solution, and the final time and the length of the x domain may also need to be changed. Modify the output for plotting the solution as required. Use subplot() for creating multiple plots within the same figure. Use xlabel, ylabel, title, legend for providing information on your plots. Use axis() to set the axis limits to be the same at all the four figures at different times for easier comparison to see how the function u(x,t) changes over time. For easier comparison use a symbol (e.g. *) not connected with lines, for plotting the solution from pdepe and continuous line for plotting the theoretical solution (on the same graph).]
Sri K.
Consider the following Boundary Value Problem (BVP) for the function u(x,y) in the rectangle 0 ≤ x ≤ a, 0 ≤ y ≤ b: ∂²u/∂x² + ∂²u/∂y² = 0, 0 < x < a, 0 < y < b, (1) u(x,0) = f(x), 0 < x < a, (2) u(x,b) = g(x), 0 < x < a, (3) u(0,y) = 0, 0 < y < b, (4) u(a,y) = 0, 0 < y < b, (5) where f and g are two, yet unspecified, smooth functions of x. 1. Seeking a solution to Equation (1) of the form u(x,t) = X(x)Y(y), show that X'' + λX = 0, Y'' - αY = 0, where λ is a constant. 2. Show that the boundary conditions of Equations (4)-(5) can only be satisfied by the trivial solution when λ < 0 and when λ = 0. 3. When λ > 0 (λ = μ², say, where μ > 0), find the eigenvalues λn and the corresponding eigensolutions Xn(x), Yn(y) to Equations (1), (4), (5). 4. Show that the solution for the entire BVP of Equations (1), (2), (3), (4), (5) is u(x,y) = ∑ [an [cosh(√λny) - cosh(√λnb)/sinh(√λnb) sinh(√λny)] + cn sinh(√λny)/sinh(√λnb)] sin(√λnx), where the an's and cn's are the Fourier sine coefficients of f and g. 5. Use an hyperbolic trigonometric identity to show that the expression in the squared brackets above can be written as sinh(√λn(b - y))/sinh(√λnb). 6. The Shape of a Tent: Compute the solution when a = b = 1 and f(x) = g(x) = {2x, 0 < x < 1/2; 2(1-x), 1/2 < x < 1, and generate a perspective view of the surface z = u(x,y) (show the code). 7. Create a single pdf file for your solution paper. Note: You may pair with another student for this assignment. In that case you will both get the same mark. Please submit the same pdf each, with both names clearly indicated.
Adi S.
Recommended Textbooks
University Physics with Modern Physics
Physics: Principles with Applications
Fundamentals of Physics
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD