Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The concentration of pollutant bacteria c(t) in a lake decreases according to th

ID: 3871826 • Letter: T

Question

The concentration of pollutant bacteria c(t) in a lake decreases according to the following expression (unit is cfu/ml):

c = 75e1.5t + 20e0.075t

We’ll use various methods to determine the time required for the bacteria concentration to be reduced to a safe level of 15 cf u/ml.

(a) (5 pts.) Write a Matlab code to solve this problem using Newton’s method with an ini- tial guess of t0 = 0 and stopping criterion of 0.5% approximate relative error. At each iteration, your code should print (i) iteration number, (ii) approximated value of t, and (iii) approximate relative error. Print your code and the output of your code, and include them in your solutions.

(b) (5 pts.) Repeat (a) using secant method. Start at t0 = 0, t1 = 1. Name your code as secant.m.

(c) (5 pts.) Repeat (a) using bisection method. Take your initial interval to be [0, 10]. Use the midpoint value of the interval as your approximate results (e.g. t0 = 5). Name your code as bisection.m.

(d) (3 pts.) How many iterations does each method take? Which method is easier to imple- ment in Matlab? If you were given a choice, which method would you use? Why?

3. (18 pts.) The concentration of pollutant bacteria c(t) in a lake decreases according to the following expression (unit is cfu/ml) 75e-1.5t + 20e-0.075t c We'll use various methods to determine the time required for the bacteria concentration to be reduced to a safe level of 15 cfu/mi (a) (5 pts.) Write a Matlab code to solve this problem using Newton's method with an ini- tial guess of t0 = 0 and stopping criterion of 0.5% approximate relative error. At each iteration, your code should print (i) iteration number, (ii) approximated value of t, and (iii) approximate relative error. Print your code and the output of your code, and include them in your solutions. Name your code as newton.m and submit a soft copy as an e-mail attachment with subject line ENGR8103HW2 to pirmoradiQuga.edu (b) (5 pts.) Repeat (a) using secant method. Start at to = 0, ti-1. Name your code as secant.m (c) (5 pts.) Repeat (a) using bisection method. Take your initial interval to be [0, 10]. Use the midpoint value of the interval as your approximate results (e.g. to 5). Name your code as bisection.m. (d) (3 pts.) How many iterations does each method take? Which method is easier to imple- ment in Matlab? If you were given a choice, which method would you use? Why?

Explanation / Answer

Ans:
The concentration of pollutant bacteria c in a lake decreases in line with
c = 75e1.5t + 20e0.075t
determine the time required for the bacteria awareness to be reduced to fifteen the use of (a) the graphicaltechnique and (b) the usage of the Newton-Raphson approach with an preliminary guess of t = 6 and apreventing criterion of zero.5%

from the graph we can say the time t = four.002 while c=15 b) uning newton raphson method intial bet of 6. code: >> begins here t = 6; t_old = one hundred; iter = 0; even as abs(t_old-t) > 5*10^-three && x ~= 0 t_old = t; t= t+ (75*exp(-1.5*t)+20*exp(-0.0.5*t)-15)/(seventy five*1.5*exp(-1.five*t)+20*zero.1/2*exp(-0.0.5*t)); iter = iter + 1; fprintf('new release %d: t=%.20f, err=%.20fn', iter, t, t_old-t);

A)

Dear Student for the Question A I'm taking example Location instead of iteration .at MATLAB

places=[1 2 ; 2 3 ; 4 5];
P1=[1 2 3];
input= [3 4 5]
fid= fopen('GCode.txt','w');
for x = P1(1) : P1(cease)
fprintf(fid,'G0 Xp.cd Y%d Z0 n',places(x,1),locations(x,2));
for y = 1:input(x);
fprintf(fid,'G0 Z1 n G0 Z0');
end
quit
fclose(fid);

iteration 1:

G0 X1 Y2 Z0 G0 Z1 G0 Z0

G0 Z1 G0 Z0

G0 Z1 G0 Z0

generation 2:

G0 X2 Y3 Z0 G0 Z1 G0 Z0

G0 Z1 G0 Z0

G0 Z1 G0 Z0

G0 Z1 G0 Z0

new release 3:

G0 X4 Y5 Z0 G0 Z1 G0 Z0

G0 Z1 G0 Z0

G0 Z1 G0 Z0

G0 Z1 G0 Z0

G0 Z1 G0 Z0

however when going for walks this code, it only outputs the final iteration of the for loop as opposed to theresult of every generation in a list to the .txt report.

b)

feature x = mysecant (f , x0 , x1 , n )
% Solves f(x) = 0 via doing n steps of the secant technique
% starting with x0 and x1.
% Inputs : f -- the characteristic
% x0 -- starting guess , various
% x1 -- 2nd starting guess
% n -- the variety of steps to do
% Output : x -- the approximate solution
y0 = f ( x0 );
y1 = f ( x1 );
for i = 1: n % Do n times
x = x1 - ( x1 - x0 )* y1 /( y1 - y0 ) % secant formula .
y = f ( x ) % y price at the brand new approximate answer .
% pass numbers to get geared up for the subsequent step
x0 = x1 ;
y0 = y1 ;
x1 = x ;
y1 = y ;
stop
end

c)Bisection method is the simplest among all the numerical schemes to solve the transcendental equations. This scheme is based totally on the intermediate value theorem for continuous features .

bear in mind a transcendental equation f (x) = zero which has a 0 within the c program languageperiod [a,b] and f (a) * f (b) < zero. Bisection scheme computes the zero, say c, by again and again halving the c language[a,b]. that is, beginning with

c = (a+b) / 2
the interval [a,b] is changed either with [c,b] or with [a,c] depending at the signal of f (a) * f (c) . This manneris sustained until the zero is received. because the 0 is received numerically the value of c might not exactlyhealthy with all the decimal locations of the analytical answer of f (x) = 0 in the c program languageperiod[a,b]. hence someone of the following mechanisms may be used to prevent the bisection iterations :

C1. fixing a priori the entire variety of bisection iterations N i.e., the period of the c programming languageor the most mistakes after N iterations in this situation is much less than | b-a | / 2N.

C2. by means of testing the condition | ci - c i-1| (wherein i are the generation range) much less than sometolerance limit, say epsilon, fixed a priori.

C3. by means of checking out the situation | f (ci ) | less than some tolerance restrict alpha again fixed a priori.

Algorithm - Bisection Scheme

Given a feature f (x) continuous on an interval [a,b] and f (a) * f (b) < 0
Do
c = (a+b)/2
if f (a) * f (c) < zero then b = c
else a = c
(not one of the convergence standards C1, C2 or C3 is happy).

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote