Note: To solve a problem by variation of parameter, first write it ...

Transcribed Text

Note: To solve a problem by variation of parameter, first write it in the standard form: Problem 1 (20 points) Solve the following differential equation by variation of parameter: x2y"+xy'-y=lnx Problem 2 (20 points) Solve the following initial value problem: = x,y(1) = 1;y'(1) = -1/2 Problem 3 (60 points) Consider the Plug Flow Reactor problem discussed in class on 09-11-2017: NO2 is flowing through a plug flow reactor, in which it reacts and is consumed following a 2nd order kinetics. Assuming steady state and absence of axial diffusion, determine how the concentration of NO2 changes along the reactor, if it enters the reactor at a concentration of Co. The consumption rate of NO2 is given as: k CNO2' where k= 5030 mm mole sec Solve the developed ODE using the following numerical methods: (a) Euler (b) Trapezoidal and (c) Backward Euler. For each of the cases, integrate within the limits of 0 T 2. Plot = versus T by varying h (step length) as: 0.1 0.2, 0.5, 1.0. Present the results in the following comparative plots: (i) Plot the solution of explicit Euler method for different h values and compare with analytical solution. Comment on stability and accuracy of the method. (ii) Plot the solution of Trapezoidal method for different h values and compare with analytical solution. Comment on stability and accuracy of the method. (iii) Plot the solution of backward Euler method for different h values and compare with analytical solution. Comment on stability and accuracy of the method. (iv) Plot the percentage relative error versus T for each of the methods (h=0.5). Discuss the accuracy of each of the methods. Calculate % relative error by the following: Numerical value Analytical value) Analytical value timestep Present the plots and copy-paste the script in your answer sheet.

Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

clear t %Clear old time steps
clear y %Clear y values from previous runs
a=0;    % Initial tau
b=2;    % Final tau
f_an = @(tau) 1./(1+tau);
h=[0.1 0.2 0.5 1.0];   %Incremental time step
y0=1;    % Initial value y(a)
figure('Name','Backward Euler:Numerical-Analytical solution comparison plot','NumberTitle','off');
y_an = f_an(a:h(1):b);
plot(a:h(1):b,y_an,'Color',rand(1,3),'LineWidth',2);
legendInfo{1}='Analytical solution';
hold on;
for i=1:length(h)
N=(b-a)/h(i);    % Number of time steps
for n=1:N % For loop, sets next t,y values
tau(n+1) = tau(n)+h(i);
% here newton-Raphson will be used to iteratively solve y(n+1)
% two new variables are introduced for N-R.
% ynr1 will represent the kth iteration and ynr2 the (k+1) iteration
ynr1 = y_n(n);%initialize NR
loopcount = 0; diff = 1;
while abs(diff)>0.0005
loopcount = loopcount+1;
ynr2=ynr1 - (h(i)*(ynr1^2)+ynr1-y_n(n))/(1+2*h(i)*ynr1); %N-R iteration
diff = (ynr2-ynr1)/ynr2; %evaluates convergence
ynr1=ynr2...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

\$35.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available MATLAB for Mathematics Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.