function C = condif (n,c) * c is a square convection-diffusion matrix of order n^2. The user must supply n and % the convection coefficients c(1:2). I = speye (n): N = sparse (1:n-1,2:n,1,n, n); N%3D

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Exercise 1.9.3 The MATLAB m-file shown below produces matrices of discretized convection-
diffusion operators of various sizes.
function C = condif (n,c)
* C is a square convection-diffusion matrix
% of order n^2. The user must supply n and
% the convection coefficients c(1:2).
I = speye (n):
sparse (1:n-1,2;n,1,n,n);
N =
(1-c (1)) *N - (1+c (1)) *N';
(1-c (2)) *N
F1 = 2*I
F2 = 2*I
(1+c (2)) *N' ;
C = kron (I,F1) + kron (F2, I);
Transcribed Image Text:Exercise 1.9.3 The MATLAB m-file shown below produces matrices of discretized convection- diffusion operators of various sizes. function C = condif (n,c) * C is a square convection-diffusion matrix % of order n^2. The user must supply n and % the convection coefficients c(1:2). I = speye (n): sparse (1:n-1,2;n,1,n,n); N = (1-c (1)) *N - (1+c (1)) *N'; (1-c (2)) *N F1 = 2*I F2 = 2*I (1+c (2)) *N' ; C = kron (I,F1) + kron (F2, I);
[Q2] (Section 1.6/1.9: Sparse Systems; Example 1.9.1) In this exercise we will walk through
the exact steps of Example 1.9.1 using MATLAB.
(a) Create the file condif.m that is exactly the MATLAB code given in Exercise 1.9.3,
on the bottom of page 109 in [1].
(b) Create an 81 × 81 matrix A in MATLAB via: A = condif(9,[0.2 5])
(c) Compute the LU decomposition of A via: [L,U,P]
(d) View the nonzero structure of A and the added factors L+ U using spy ().
(e) Reorder the columns of A using MATLAB's builtin column-wise minimum degree
routine colamd () to produce A. Refactor the reordered Å, and then look at the
modified nonzero structure of the reordered A and its added factors L+U.
lu (A)
Transcribed Image Text:[Q2] (Section 1.6/1.9: Sparse Systems; Example 1.9.1) In this exercise we will walk through the exact steps of Example 1.9.1 using MATLAB. (a) Create the file condif.m that is exactly the MATLAB code given in Exercise 1.9.3, on the bottom of page 109 in [1]. (b) Create an 81 × 81 matrix A in MATLAB via: A = condif(9,[0.2 5]) (c) Compute the LU decomposition of A via: [L,U,P] (d) View the nonzero structure of A and the added factors L+ U using spy (). (e) Reorder the columns of A using MATLAB's builtin column-wise minimum degree routine colamd () to produce A. Refactor the reordered Å, and then look at the modified nonzero structure of the reordered A and its added factors L+U. lu (A)
Expert Solution
steps

Step by step

Solved in 5 steps with 8 images

Blurred answer
Knowledge Booster
Matrix multiplication
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education