Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ONLY DO PART C OF THE PROBLEM PLEASE HERE IS PART A and B % Part a ---------------------------------------------------------------- Ti=0; Tf=2; dt=0.05; Y(1)=3; t(1) =Ti; N=

ONLY DO PART C OF THE PROBLEM PLEASE

HERE IS PART A and B

%Part a---------------------------------------------------------------- Ti=0; Tf=2; dt=0.05; Y(1)=3; t(1) =Ti; N= round((Tf-Ti)/dt); a=4; for n=1:N Y(n+1)= (1+ a*dt) *Y(n); t(n+1) = dt + t(n); end figure plot(t, Y, '*', t, exp(a.*t),'o' ) % part b--------------------------------------------------------------- Ti=0; Tf=2; dt=0.05; X(1)=3; t(1) =Ti; q =.2./3; N= round((Tf-Ti)/dt); a=3; for n=1:N X(n+1)= ((1+ a*dt) * X(n)) + (dt*q); t(n+1) = dt + t(n); end figure plot(t, X, '*', t, exp(a.*t),'o' ) image text in transcribed

Let Y_n be an approximate to the solution y(t) at t_n = n delta t. That is y(n delta t) almost equal to Y_n where n = 1, 2, N and delta t = T/N. We now write the differential equation y' = ay to a difference equation Y_n+1-Y_n/delta t = aY_n and we have Euler's method: Y_n+1 = (1 +(a delta t)Y_n The example below illustrates the MATLAB syntax to find/plot the approximates Y_n by using Euler's method for y' = ay. Euler's method %solve y'= a*y in the time interval 0 to 2, 2 with y(0)=3, a=5, Ti=0: Tf=2: dt=0.1: Y(1)=3: t(1) = Ti: N= round ((Tf-Ti)/dt): a=5: for n=1: N Y(n+1) = (1+ a+dt) *Y(n): t(n+1) = dt + t (n): end figure plot(t, Y, '*', t, exp(a.*t), 'o') plot the approximate Y and the exact solution y=exp(a*t) 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 grams per minute. (a) Recall that we had a differential equation of form Y' = aY where Y = y - y_infinity, and y_infinity is the steady state concentration. Write MATALB scripts using Euler's method to find the approximates Z_n for Y(t). Set T = 1, 2, 5 and delta t = 0.1, 0.05, 0.01, Draw the solution Y(t_n) and the approximates Z_n for various different values of A. (b) Write MATALB scripts using Euler's method to find the approximates X_n for y(t). Draw the solution X(t_n) and the approximates X_n for the same values of A that you chose in the first part. (c) For each T = 1, 2, 5 and delta 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 error, and find the maximum absolute values using the following MATLAB scripts. Make a table for the errors for each T and delta t. 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

Understand why empowerment is so important in many frontline jobs.

Answered: 1 week ago