Question: I only need help with PART C. Here is PART A and B: clear all %Part a---------------------------------------------------------------- Ti=0; Tf=2; dt=0.05; Y(1)=3; t(1) =Ti; N= round((Tf-Ti)/dt);
Euler's method: Let y be an approximate to the solution y(t) at tn 1. That is y(n ) Y, where n = 1, 2, ..N and , T N. We now write the differential equation y' ay to a difference equation Yn = ay, and we have | Euler's method: Yn+1 = (1 +(A)Y,, The example below illustrates the MATLAB syntax to find/plot the approxiates Y by using Euler's method for y' = ay Euler'smethod %solve y'- a*y in z the time interval 0 to 2, with y(0)-3, a#5. round ((Tf-Ti)/dt }; N= a5; 4 7 for n-1:N Y(n+i)1t a.dt) Y(n) i e end figure plot(t, 12 13 Y, "c', t, expia. *t),"o, 4plot the approximate Y and the exact 80 1 ution yexp(a*t) . Math Modeling for drug concentration: Recall in WS2 we found the mathematical model for the drug concentration y(t) in a patient's body at time t. Assume as the same as before that the drip feeds q = 0.2 grams per minute into the patient's arm, and the body eliminates the drug at the rate 3 grains per minute (a) Recall that we had a differential equation of form Y, = aY where Y = y-Dm, and y c is the steady state concentration. Write MATALB scripts using Euler's method to find the approximates Z, for Y(t). Set T = 1, 2, 5 and t = 0.1, 0.05, 0.01, Draw the solution Y(t") and the approximates for various different values of A (b) Write MATALB scripts using Euler's method to find the approximates X for yit). Draw the solution X( and the approximates X for the same values of A that you chose in the first part (c) For each T = 1.25 and t = 0.1. 0.05, 0.01, compare the results from the first part and the second part of the problems, by evaluating the differences between the exact solution and the approximates, which is called the r, and find the maximum absolute values using the MATLAB scripts. 1 errYZ-nax (abs (Y,Z}); maximum absolute error between Y and Z Make a table for the errors for each T and . Plot the errors, state what you found from the errors, and give suggestions how the errors can be minimized
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
