Linear algebraic equations can arise in the solution of differential equations.
ID: 1858719 • Letter: L
Question
Linear algebraic equations can arise in the solution of differential equations. For example, the following differential equation results from a steady-state mass balance for a chemical in a one-dimensional canal:
0=D*(((d^2)c)/(d*x^2))-U((d*c)/(d*x))-k*c
where c=concentration, t=time, x=distance, D=diffusion coefficient, U=fluid velocity, and k=a first-order decay rate. Convert this differential equation to an equivalent system of simulations algebraic equations. Given D=2, U=1, k=0.2, c(0)=80 and c(10)=10, solve these equations from x=0 to 10 and develop a plot of concentration versus distance.
how do you transform the differential equation into a system into linear equations?
Explanation / Answer
%Problem 11.27 D = 2 U = 1 k = 0.2 c_0 = 80 c_10 = 20 A = [-2*D-k D-U/2 0 0 0 0 0 0 0; ... D+U/2 -2*D-k D-U/2 0 0 0 0 0 0; ... 0 D+U/2 -2*D-k D-U/2 0 0 0 0 0; ... 0 0 D+U/2 -2*D-k D-U/2 0 0 0 0; ... 0 0 0 D+U/2 -2*D-k D-U/2 0 0 0; ... 0 0 0 0 D+U/2 -2*D-k D-U/2 0 0; ... 0 0 0 0 0 D+U/2 -2*D-k D-U/2 0; ... 0 0 0 0 0 0 D+U/2 -2*D-k D-U/2; ... 0 0 0 0 0 0 0 D+U/2 -2*D-k] b = [(-D-U/2)*c_0; 0; 0; 0; 0; 0; 0; 0; (-D+U/2)*c_10] c = A b plot([c_0; c(:); c_10] )
%Problem 11.27 D = 2 U = 1 k = 0.2 c_0 = 80 c_10 = 20 A = [-2*D-k D-U/2 0 0 0 0 0 0 0; ... D+U/2 -2*D-k D-U/2 0 0 0 0 0 0; ... 0 D+U/2 -2*D-k D-U/2 0 0 0 0 0; ... 0 0 D+U/2 -2*D-k D-U/2 0 0 0 0; ... 0 0 0 D+U/2 -2*D-k D-U/2 0 0 0; ... 0 0 0 0 D+U/2 -2*D-k D-U/2 0 0; ... 0 0 0 0 0 D+U/2 -2*D-k D-U/2 0; ... 0 0 0 0 0 0 D+U/2 -2*D-k D-U/2; ... 0 0 0 0 0 0 0 D+U/2 -2*D-k] b = [(-D-U/2)*c_0; 0; 0; 0; 0; 0; 0; 0; (-D+U/2)*c_10] c = A b plot([c_0; c(:); c_10] )
%Problem 11.27 D = 2 U = 1 k = 0.2 c_0 = 80 c_10 = 20 A = [-2*D-k D-U/2 0 0 0 0 0 0 0; ... D+U/2 -2*D-k D-U/2 0 0 0 0 0 0; ... 0 D+U/2 -2*D-k D-U/2 0 0 0 0 0; ... 0 0 D+U/2 -2*D-k D-U/2 0 0 0 0; ... 0 0 0 D+U/2 -2*D-k D-U/2 0 0 0; ... 0 0 0 0 D+U/2 -2*D-k D-U/2 0 0; ... 0 0 0 0 0 D+U/2 -2*D-k D-U/2 0; ... 0 0 0 0 0 0 D+U/2 -2*D-k D-U/2; ... 0 0 0 0 0 0 0 D+U/2 -2*D-k] b = [(-D-U/2)*c_0; 0; 0; 0; 0; 0; 0; 0; (-D+U/2)*c_10] c = A b plot([c_0; c(:); c_10] )
%Problem 11.27 D = 2 U = 1 k = 0.2 c_0 = 80 c_10 = 20 A = [-2*D-k D-U/2 0 0 0 0 0 0 0; ... D+U/2 -2*D-k D-U/2 0 0 0 0 0 0; ... 0 D+U/2 -2*D-k D-U/2 0 0 0 0 0; ... 0 0 D+U/2 -2*D-k D-U/2 0 0 0 0; ... 0 0 0 D+U/2 -2*D-k D-U/2 0 0 0; ... 0 0 0 0 D+U/2 -2*D-k D-U/2 0 0; ... 0 0 0 0 0 D+U/2 -2*D-k D-U/2 0; ... 0 0 0 0 0 0 D+U/2 -2*D-k D-U/2; ... 0 0 0 0 0 0 0 D+U/2 -2*D-k] b = [(-D-U/2)*c_0; 0; 0; 0; 0; 0; 0; 0; (-D+U/2)*c_10] c = A b plot([c_0; c(:); c_10] )
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.