Maximum error in not-a-knot spline of bessel function

In summary, the function f returns the y coordinate of the points on the spline at 500 points in the interval between 0 and 2.
  • #1
gfd43tg
Gold Member
950
50

Homework Statement


If you didn't already, download splineFunctions.zipView in a new window. This contains the splineE7.p and splinevalueE7.p function files.

The syntax is as follows: If Xdata and Ydata are vectors with the same number of elements, then four various splines can be created as

Code:
SN = splineE7(Xdata,Ydata,'N');        % Natural
SK = splineE7(Xdata,Ydata,'K');        % not-a-knot
SP = splineE7(Xdata,Ydata,'P');        % Periodic
SE = splineE7(Xdata,Ydata,'E',v1,vN);  % end-slope

If xG is an array, then the various splines can be evaluated at the values in xG using splinevalueE7, for example

Code:
yG = splinevalueE7(S,xG)

where S is one of the created splines.

Define a function using Bessel functions of the 2nd kind, which is the solution to an important differential equation arising in acoustics and other engineering disciplines. Define a function f via an anonymous function,

Code:
f = @(x) besselj(x,2);

Consider a not-a-knot-spline fit to the function ##f(x)##, using 10 points, with ##\left\{ x_i \right\}_{i=1}^{10}## linearly spaced from 0 to 2. Associated with this spline, compute the maximum absolute value of the error, evaluated on a denser grid, with 500 points linearly spaced from 0 to 2. Which of the numbers below is approximately equal to that maximum absolute error?

Now consider a natural spline fit to the function ##f(x)##, using 10 points, with ##\left\{ x_i \right\}_{i=1}^{10}## linearly spaced from 0 to 2. Associated with this spline, compute the maximum absolute value of the error, evaluated on a denser grid, with 500 points linearly spaced from 0 to 2. Which of the numbers below is approximately equal to that maximum absolute error?

Homework Equations


The Attempt at a Solution


Code:
f = @(x) besselj(x,2);
x = linspace(0,2,10);
S = splineE7(x,f(x),'K')
S = 

    Coeff: [4x9 double]
        x: [0 0.2222 0.4444 0.6667 0.8889 1.1111 1.3333 1.5556 1.7778 2]
        y: [1x10 double]

I don't understand how to find the maximum error. I uploaded the p-files for the spline functions.
 

Attachments

  • splineFunctions.zip
    1.2 KB · Views: 240
Last edited:
Physics news on Phys.org
  • #2
I think they want you to estimate the error numerically, not by trying to do some clever math.

Evaluate the splines and the Bessel function at 500 points in the interval, and find the biggest absolute difference.
 
  • #3
How would I do that? None of the inputs in either splineE7 or splinevalueE7 are points in the interval.
 
  • #4
Your variable S contains all data about the spline. You don't need to know the details of what it contains, but from what you printed out, it's a reasonable guess that the "x" values you printed out are 10 points between 0 and 2.

Splineval takes two arguments, the variable S, and an array of X values (i.e. the x coordinate of the 500 points between 0 and 2). It returns the y coordinates of the points on the spline.
 
  • #5
Okay I got it, thanks
 

Related to Maximum error in not-a-knot spline of bessel function

1. What is a not-a-knot spline?

A not-a-knot spline is a type of mathematical function used to approximate a curve or surface. It is a piecewise polynomial function that has continuous derivatives at each knot (point of intersection) and has an additional condition that the second derivative is also continuous at the first and last knots.

2. How is the Bessel function related to not-a-knot splines?

The Bessel function is a special mathematical function commonly used in physics and engineering to describe oscillatory behavior. It can be approximated using not-a-knot splines, which provide a smoother and more accurate representation of the function compared to other methods.

3. What is maximum error in not-a-knot spline of Bessel function?

The maximum error in a not-a-knot spline of a Bessel function refers to the maximum difference between the actual function and its approximation using the spline. This error is typically measured at specific points or over a range of values and is used to evaluate the accuracy of the approximation.

4. How is the maximum error calculated in not-a-knot spline of Bessel function?

The maximum error in a not-a-knot spline of a Bessel function is typically calculated by finding the maximum absolute difference between the actual function and the spline at a set of predetermined points. This can be done using mathematical formulas or computer algorithms.

5. How can the maximum error in not-a-knot spline of Bessel function be minimized?

The maximum error in a not-a-knot spline of a Bessel function can be minimized by increasing the number of knots used in the spline, which leads to a more accurate approximation. Additionally, using higher-degree polynomials and adjusting the placement of the knots can also help reduce the maximum error.

Similar threads

  • Programming and Computer Science
Replies
3
Views
441
  • Engineering and Comp Sci Homework Help
Replies
3
Views
841
Replies
3
Views
313
  • Calculus and Beyond Homework Help
Replies
8
Views
1K
Replies
14
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
364
  • Calculus and Beyond Homework Help
Replies
4
Views
2K
Replies
1
Views
1K
Back
Top