Question: Here's the code: function orthog_list = gramschmidt(weight, lowerLim, upperLim, maxDegree) % This function performs Gram-Schmidt orthogonalization to construct a % list of maxDegree + 1

Here's the code:

function orthog_list = gramschmidt(weight, lowerLim, upperLim, maxDegree) % This function performs Gram-Schmidt orthogonalization to construct a % list of maxDegree + 1 polynomials (degree 0 to degree maxDegree) % that are orthogonal on % [lowerLim, upperLim] % with respect to the weight function 'weight'. % Returns the list of maxDegree + 1 orthogonal functions.

syms y; syms x; orthog_list = cell(1, maxDegree + 1);

% The first orthogonal function is always the constant function orthog_list{1} = @(y) 1*y.^(0); disp(orthog_list{1}(x)); % The second orthogonal function is x - B1 where B1 is a ratio of integrals (see notes) B1 = int(y * weight(y), y, lowerLim, upperLim) ./ int(weight(y), y, lowerLim, upperLim); orthog_list{2} = @(y) y - B1; disp(orthog_list{2}(x)); if maxDegree

for deg = 3:maxDegree+1 % Now we compute the Bk and Ck coefficients from the Gram-Schmidt theorem Bk = int(y .* weight(y) .* orthog_list{deg-1}(y).^2, y, lowerLim, upperLim) ./ ... int(weight(y) .* orthog_list{deg-1}(y).^2, y, lowerLim, upperLim);

Ck = int(y .* weight(y) .* orthog_list{deg-1}(y) .* orthog_list{deg-2}(y), y, lowerLim, upperLim) ./ ... int(weight(y) .* orthog_list{deg-2}(y).^2, y, lowerLim, upperLim);

% Define the g function g = @(y) (y - Bk) .* orthog_list{deg-1}(y) - Ck .* orthog_list{deg-2}(y); orthog_list{deg} = g; disp(orthog_list{deg}(x)); end end

Here's the code: function orthog_list = gramschmidt(weight, lowerLim, upperLim, maxDegree) % This

Using the Gram-Schmidt code from homework 6, find and plot on the same axes the first 5 polynomials orthogonal on the interval [1,3] to the weight w(x)=2x,1x3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!