Can I improve the sinc interpolation?

Click For Summary

Discussion Overview

The discussion revolves around improving the Shannon interpolation method for two-dimensional data in Mathematica. Participants explore alternatives to achieve better results with fewer terms while addressing issues related to the computational efficiency and accuracy of the interpolation.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant describes their implementation of a two-dimensional Shannon interpolation in Mathematica and expresses the need for an unreasonably high number of terms to achieve satisfactory results.
  • Another participant seeks a method that allows for interpolation while returning an expression usable for evaluation at any point, similar to Shannon interpolation, but with fewer terms required.
  • Some participants suggest exploring alternative methods listed in a Wikipedia article on multivariate interpolation, indicating that these might meet the needs of the original poster.
  • Concerns are raised about the clarity of the original poster's question and the need for more focused inquiries to facilitate better assistance.
  • One participant questions the effectiveness of the original code, suggesting that it may not be functioning correctly or that the sample grid used might be inappropriate.
  • There is a suggestion that using simpler functions, such as bicubic interpolation over a finer grid, could yield better results while maintaining computational efficiency.

Areas of Agreement / Disagreement

Participants express differing views on the effectiveness of the current implementation and the appropriateness of the chosen methods. There is no consensus on a specific alternative to Shannon interpolation, and the discussion remains unresolved regarding the best approach to take.

Contextual Notes

Participants note potential limitations in the original poster's approach, including the possibility of using a strange sample grid or differences in contour intervals between plots. There is also mention of the need for clearer questions to facilitate more effective responses.

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: 184
  • 1a_original.jpg
    1a_original.jpg
    11.3 KB · Views: 176
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