Can I improve the sinc interpolation?

Click For Summary
SUMMARY

The discussion centers on improving Shannon interpolation in Mathematica, specifically when dealing with large datasets requiring excessive terms for accurate results. The user, identified as "confused_engineer," seeks alternatives to reduce the number of terms needed for effective interpolation. Suggestions include exploring methods listed in the Wikipedia article on multivariate interpolation and considering simpler functions like bicubic interpolation over finer grids to enhance performance.

PREREQUISITES
  • Proficiency in Mathematica for implementing interpolation techniques.
  • Understanding of Shannon interpolation and its mathematical foundations.
  • Familiarity with multivariate interpolation methods.
  • Knowledge of contour plotting and data visualization techniques.
NEXT STEPS
  • Research "Mathematica bicubic interpolation" for simpler alternatives to Shannon interpolation.
  • Explore "Multivariate interpolation techniques" as outlined on Wikipedia.
  • Learn about "Interpolation methods in numerical analysis" for broader context.
  • Investigate "ContourPlot options in Mathematica" to enhance data visualization.
USEFUL FOR

Data scientists, mathematicians, and engineers working with interpolation methods in Mathematica, particularly those seeking to optimize performance with large datasets.

confused_engineer
Messages
34
Reaction score
1
TL;DR
I am having trouble since I need to use too many terms to reproduce what I am looking for.
Hello everyone. I am working with mathematica, where I have developed a two-dimensional shannon interplation, just as can be seen in the slides 15 to 18 of this presentation. The code is as follows:

[CODE title="Shannon interpolation"]savedX = Table[XposX = mat[[All, 1]]; YposX = mat[[All, 2]];
windXVal = mat[[All, i]];
windXMat = Transpose[{XposX, YposX, windXVal}];
ifuncEPSX = Interpolation[windXMat //. {x_List} :> x];
intDataVectorEPSX =
Flatten[Table[{t, u, ifuncEPSX[t, u]}, {t, xmin, xmax,
dDeltaXwX}, {u, ymin, ymax, dDeltaYwX}]];
leEPSX = Length@intDataVectorEPSX;
vectorXintEPSX =
Table[intDataVectorEPSX[], {i, 1, leEPSX - 2, 3}];
vectorYintEPSX =
Table[intDataVectorEPSX[], {i, 2, leEPSX - 1, 3}];
vectorFintEPSX = Table[intDataVectorEPSX[], {i, 3, leEPSX, 3}];
interpolatedDataEPSX =
Transpose[{vectorXintEPSX, vectorYintEPSX, vectorFintEPSX}];
shannonInterpolationWindX[alpha_, beta_] =
Total[#3*sinc[(alpha - #1)/dDeltaXwX]*
sinc[(beta - #2)/dDeltaYwX] & @@@ interpolatedDataEPSX], {i,
3, countMax + 2}];

ContourPlot[
shannonInterpolationWindX[t, u], {t, xmin, xmax}, {u, ymin, ymax},
GridLines -> {{xmax, xmin}, None}, PlotLegends -> Automatic]
[/CODE]
Unfortunately, if I use the attached data, I need an unreasonably long number of terms to propperly reproduce the wind that I am delaing with.

Can someone please recommend me an alternative to this Shannon interpolation so that I would get a better result using fewer terms?

EDIT: Since I cannot upload the data as .nb, for the mathematica file and .mat for the data, I have tried to convert them to text files just in case it can be useful.

Any answer is appreciated.
Thanks for reading.
Best regards.
confused_engineer.
 

Attachments

Last edited:
Technology news on Phys.org
Hello everyone. I am looking for a way to interpolate data and obtaining in return an expression which can be used to evaluate the expression at any point.

An example of this would be the Shannon interpolation (see slides 15 to 18) which return a sum of cardinal sines and can be evaluated anywhere. The problem I am having with this data is that I need an enormous amount of terms to obtain an expression which makes a decent interpolation and I am looking for alternatives.

I will attach one example constructed using mathematica of a Shannon interpolation using 6400 terms and the original data.

Any answer is appreciated.
Best regards.
Confused engineer.
 

Attachments

  • 1a_interp.jpg
    1a_interp.jpg
    9.8 KB · Views: 182
  • 1a_original.jpg
    1a_original.jpg
    11.3 KB · Views: 173
Posting a load of stuff as attachments and saying "I want this to work better" is a big ask, you need to find a way to help us to help you with a more focussed question (which you have done in a different topic, I'll get it merged).
 
  • Like
Likes   Reactions: Vanadium 50 and BvU
This is a strange topic to post this question in - you would be better off in Matlab/Maple/Mathematica/Latex or Programming and Computer Science.

Ah, I see you did try a different question there, I'll get the threads merged.

confused_engineer said:
I will attach one example constructed using mathematica of a Shannon interpolation using 6400 terms and the original data.
Either
  1. your code is not working; or
  2. you are using a strange sample grid; or
  3. the two plots use different contour intervals.

How do I know this? The interpolation should be exactly equal to the original at the grid points, and if you pick for example the horizontal mid-line the shading is clearly different at 80 ## (=\sqrt{6400}) ## reasonably spaced points on that line.

Back to the answer to your question: if you hold computing time constant, in general you will obtain a 'better' interpolation using a simpler function (e.g. bicubic) over a finer grid. It states this in the slides you linked, have you read and understood them?
 
Last edited:
  • Like
Likes   Reactions: BvU
  • Like
Likes   Reactions: BvU

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K