MATLAB Script:
close all
clear
clc
format rat
syms x
f = [1 -2 0 0]; % x^3 - 2*x^2
g = [1 0]; % x
disp('Polynomials:')
fprintf('f = '), disp(f)
fprintf('g = '), disp(g)
r = inner_prod(f, g);
fprintf('\nInner Product of f and g ='), disp(r)
n = norm(f);
fprintf('Norm of f = '), disp(n)
% Inner Product
function r = inner_prod(p, q)
poly_prod = conv(p, q); % Multiplying p and q
poly_int = polyint(poly_prod); % Integrate p*q
r = (1/2) * (polyval(poly_int, 1) - polyval(poly_int, -1)); %
Evaluate at the limits of integration, 1 and -1
end
% Norm
function n = norm(p)
n = sqrt(inner_prod(p, p));
end
Output:
USING MATLAB Create Inner-Product 3.2 The inner-product we will be using in the problem is defined...
Problem 1. Let the inner product (,) be defined by (u.v)xu (x)v (x) dx, and let the norm Iilbe defined by lIul-)Corhe target funtio), and work with the approximating space P4 Use Gram-Schmidt orthogonalization with this inner product to find orthogonal polynomials (x) through degree four. Standardize your polynomials such that p: (1) 1. (a) Form the five-by-five Gram matrix for this inner product with the basis functions p (x) degree 4 approximation o f (x) using the specified norm,...
let P3 denote the vector space of polynomials of degree 3 or less, with an inner product defined by 14. Let Ps denote the vector space of polynomials of degree 3 or less, with an inner product defined by (p, q) Ji p(x)q(x) dr. Find an orthogo- nal basis for Ps that contains the vector 1+r. Find the norm (length) of each of your basis elements 14. Let Ps denote the vector space of polynomials of degree 3 or less,...
Problem 1. Let the inner prodct )be deined by (u.v)xu (x) v (x) dx, and let the norm |I-ll be defined by ull , ).Consider the target function f (x) with the approximating space P e', and work 2. Use Gram-Schmidt orthogonalization with this inner product to find orthogonal polynomials p (x) through degree four. Standardize your polynomials such that p, (1) 1 (b) Find the best degree 4 approximation to f(x) using the specified norm, and working with this...
Please help for Question 10A.1 MATH 270 SPRING 2019 HOMEWORK 10 10A. 1. Let S be the subspace in R3 spanned by21.Find a basis for S 2. Using as the inner product (5) ( p. 246) in section 5.4 for Ps where x10, x2 -1, x3 - 2: Find the angle between p (x) = x-3 and q(x) = x2 + x + 2. b. Fnd the vector projection of p(x) on q(x) In Cl-π, π} using as an inner...
Problem 5. Consider least squares polynomial approximation to f(x) = cos (nx) on x E [-1,1] using the inner product 1. In finding coefficients you will need to compute the integral By symmetry, an 0 for odd n, so we need only consider even n. (a) Make a change of variables and use appropriate identities to transform the integral for a to cos (Bcos 8)cos (ne) de (b) The Bessel function of even order, (x), can be defined by the...
Problem 5 (programming): Create a MATLAB function named lagrange interp.m to perform interpolation using Lagrange polynomials. Download the template for function lagrange interp.m. The tem Plate is in homework 4 folder utl TritonED·TIue function lakes in the data al nodex.xi and yi, as well as the target x value. The function returns the interpolated value y. Here, xi and yi are vectors while x and y are scalars. You are not required to follow the template; you can create the...