Help with interpreting an interpolation problem

In summary, the conversation is about a homework problem asking for a MATLAB function to evaluate a trigonometric interpolant based on a given set of samples. The problem also requires testing the function using a specific function and plotting the maximum error for various values of n. The question asks for clarification on how to plot the maximum error and how to determine when the maximum error is close to machine precision. The person asking the question is using Julia instead of MATLAB.
  • #1
PhysicsKid0123
95
1

Homework Statement


I don't know if this is the appropriate place to ask this, but I really do need some help. I am doing a homework problem and I don't understand what is being asked. It goes as follows:

> Write a MATLAB function to evaluate the trigonometric interpolant ##p_n(x)## for a given set of samples, ##\bf{y}##:

Here it follows with some comments about making such a function, I'll leave that out since it's not relevant, but it goes on to say:

> To test your program use ##f(x) = 10cos(x)+5cos(3x)## and plot the maximum error ##max |p_n(x)-f(x)|## for ##n= 4,8,16,32,64.## Verify that the maximum error is close to machine precision for ##n=32,64.## What is the reason behind this?

So I was able to find the interpolating function ##p_n(x)##, but I don't know what the next part is asking. Am I supposed to find the maximum value of ##g_n(x) = |p_n(x)-f(x)|## for each ##n##, say it is ##g_n(x_0)##, then plot ##g_i(x_0)## vs ##i## for ##i= 1...n##? So effectively, each value ##g_i(x_0)## is plotted on an ##y##- axis and ##i## on a corresponding ##x##-axis? Or am I simply supposed to make a plot of ##g_n(x) = |p_n(x)-f(x)|## for each n?

Also, how do I know when I am close to machine precision? When I start getting cancellation errors?

Thank in advance for the help.

By the way, I am using Julia to do this, not MATLAB.

Homework Equations


None are relevant to my question.

The Attempt at a Solution


No solution yet, I wouldn't be asking this question.
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
Sorry, I don't know how to enable LaTex.
 
  • #3
PhysicsKid0123 said:
Sorry, I don't know how to enable LaTex.

Instead of $p_n(x)$, replace each starting and ending $ by #nospace# (two # signs with no space between them) for in-line formulas; that gives you ##p_n(x)##. If you want a displayed equation or formula, replace each starting and ending $ by $nospace$, that is, write two $ signs with no space between them. That gives you $$p_n(x)$$
 
  • #5
Mark44 said:
Fixed the LaTeX in post #1.
Yes, I got it. Thank you.
 
  • #6
Fixed the volume in post #1.
 

FAQ: Help with interpreting an interpolation problem

What is interpolation?

Interpolation is a mathematical method used to estimate values between known data points. It involves creating a function that passes through the given set of data points and using it to calculate values at intermediate points.

How is interpolation used in scientific research?

Interpolation is commonly used in scientific research to estimate values of physical quantities at points in between known data points. It is particularly useful when experimental data is limited or when values need to be estimated at non-measured points.

What is the difference between interpolation and extrapolation?

Interpolation involves estimating values within the range of known data points, while extrapolation involves estimating values beyond the range of known data points. Extrapolation can be less accurate and more uncertain than interpolation, as it relies on assumptions about the behavior of the data beyond the known points.

How do you choose the best interpolation method for a given problem?

The choice of interpolation method depends on the type of data and the behavior of the data points. Some common interpolation methods include linear, polynomial, and spline interpolation. It is important to consider the accuracy and complexity of each method and choose the one that best fits the data and the problem at hand.

What are some potential sources of error in interpolation?

There are several potential sources of error in interpolation, including inaccuracies in the original data, inappropriate choice of interpolation method, and incorrect assumptions about the behavior of the data. It is important to carefully evaluate the data and the chosen method to minimize these errors.

Similar threads

Replies
10
Views
1K
Replies
3
Views
1K
Replies
1
Views
1K
Replies
4
Views
2K
Replies
4
Views
1K
Replies
1
Views
1K
Replies
1
Views
2K
Back
Top