 # 9.1. (a) Run the six-line MATLAB program of Experiment 1 to produce...

## Question

Show transcribed text

## Transcribed Text

9.1. (a) Run the six-line MATLAB program of Experiment 1 to produce a plot of approximate Legendre polynomials. (b) For k = 0,1,2,3, plot the difference on the 257-point grid between these approximations and the exact polynomials (7.11). How big are the errois, and how are they distributed? (c) Compare these results with what you get with grid spacings Ax = 2-v for other values of v. What power of Ax appears to control the convergence? Experiment 1: Discrete Legendre Polynomials x = (-128:128)'/128; Set x to a discretization of [-1,1]. A = [x. "O x.*1 x. *2 x. *3]; Construct Vandermonde matrix. [Q,R] = qr(A,0); Find its reduced QR factorization. scale = Q(257,:); Select last row of Q. Q = Q*diag(1 ./scale); Rescale columns by these numbers. plot(Q) Plot columns of rescaled Q. Po(x) = 1, P1(x) =x, = (7.11)

## 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.

function p91()

Experiment1(7,1); % parts (a) and (b)

Experiment1(5,0); % other values of nu
Experiment1(9,0);

return;

function Experiment1(nu,plotornot)
a = 2^nu;
x = [-a:1:a]'/a;
A = [x.^0 x.^1 x.^2 x.^3];
[Q,R] = qr(A,0);
scale = Q(2*a+1,:);
Q = Q*diag(1./scale);

if( 0 ~= plotornot)
f1 = figure(1);
plot(Q);...

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

\$33.00
for this solution

or FREE if you
register a new account!

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

### Find A Tutor

View available Numerical Analysis 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.