Question: Please solve this problem in matlab. Problem [3]. Generating Legendre polynomials: a. Define a polynomial structure with a constructor that starts as function pf makePolyStruct
Please solve this problem in matlab.![Please solve this problem in matlab. Problem [3]. Generating Legendre polynomials: a.](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f4dfa05fe0f_06366f4df9fc043c.jpg)
Problem [3]. Generating Legendre polynomials: a. Define a polynomial structure with a constructor that starts as function pf makePolyStruct (pc) % Polynomial structure from a vector array pc % that represents a polynomial p (x) % pf.val function handle such that pf.Val (x) -p(x) % pf.a function handle such that pf.d(x) -p, (x) % pf.coeff = pc % pf, roots roots of p (X) Complete this function. b. Legendre polynomials are polynomials defined recursively as: . Po(x) = 1, pi (z) = z, so that, for example, the next three polynomials in this sequence are Pa)83), and ps(530+3) Define a function that generates a "Legendre structure array" that starts as: function Lg-Legendre (n) % Generate Legendre polynomials up to order n % Lg - structure array containing polynomial structures % representing Legendre polynomials up to order n % Lg(k+1) is the "PolyStruct" representation of Pk(z). Complete this function c. Write a function that produces for any given n and any given polynomial q(x), the n + 1 values, r) dx for j-0,1,...,n Your function should be called with the format: an Legint (q, n) where n is a positive integer, q is the "PolyStruct" representation of q(x) an -[ao ai .an Problem [3]. Generating Legendre polynomials: a. Define a polynomial structure with a constructor that starts as function pf makePolyStruct (pc) % Polynomial structure from a vector array pc % that represents a polynomial p (x) % pf.val function handle such that pf.Val (x) -p(x) % pf.a function handle such that pf.d(x) -p, (x) % pf.coeff = pc % pf, roots roots of p (X) Complete this function. b. Legendre polynomials are polynomials defined recursively as: . Po(x) = 1, pi (z) = z, so that, for example, the next three polynomials in this sequence are Pa)83), and ps(530+3) Define a function that generates a "Legendre structure array" that starts as: function Lg-Legendre (n) % Generate Legendre polynomials up to order n % Lg - structure array containing polynomial structures % representing Legendre polynomials up to order n % Lg(k+1) is the "PolyStruct" representation of Pk(z). Complete this function c. Write a function that produces for any given n and any given polynomial q(x), the n + 1 values, r) dx for j-0,1,...,n Your function should be called with the format: an Legint (q, n) where n is a positive integer, q is the "PolyStruct" representation of q(x) an -[ao ai .an
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
