lacy1104
28 Apr 2008, 08:40pm
I am new with matlab and I am very confused on how to write this. Can anyone help.
1. Write the following MATLAB function
function [C,X, Y ] = Chebyshev (func, N, a, b)
to construct and evaluate an interpolating polynomial of degree N for f(x) over [a, b], with the zeros of the Chebyshev polynomial of degree N + 1 as nodes.
Inputs: func - the string function to be approximated
a - left end point
b - right end point
N - the degree of the interpolating polynomial
Outputs: C - the vector containing the coefficients of the interpolating polynomial
X - the abscissa vector
Y - the ordinate vector
The results are to be in this format:
Tables for the results
x f(x) y f(x) − y
0.5
0.8
0.9
0.99
Data and Results for Problem # 1
1. f(x) = ln(x + 3) over [−1, 1]
N = 3
2. f(x) = sin x + cos x over [−1, 1]
N = 2
3. f(x) = cos x over [−1, 1].
N = 2
1. Write the following MATLAB function
function [C,X, Y ] = Chebyshev (func, N, a, b)
to construct and evaluate an interpolating polynomial of degree N for f(x) over [a, b], with the zeros of the Chebyshev polynomial of degree N + 1 as nodes.
Inputs: func - the string function to be approximated
a - left end point
b - right end point
N - the degree of the interpolating polynomial
Outputs: C - the vector containing the coefficients of the interpolating polynomial
X - the abscissa vector
Y - the ordinate vector
The results are to be in this format:
Tables for the results
x f(x) y f(x) − y
0.5
0.8
0.9
0.99
Data and Results for Problem # 1
1. f(x) = ln(x + 3) over [−1, 1]
N = 3
2. f(x) = sin x + cos x over [−1, 1]
N = 2
3. f(x) = cos x over [−1, 1].
N = 2