Can I improve the sinc interpolation?

AI Thread Summary
The discussion revolves around the challenges faced while implementing a two-dimensional Shannon interpolation in Mathematica. The user, identified as "confused_engineer," reports needing an excessive number of terms (6400) to achieve satisfactory results with their wind data interpolation. They seek alternative interpolation methods that would yield better results with fewer terms. Suggestions include exploring other multivariate interpolation techniques, as referenced in a Wikipedia article. Additionally, there are comments on the need for clearer questions and more focused data presentation to facilitate assistance. Concerns are raised about potential issues in the user's code or sample grid, which may affect the accuracy of the interpolation. The conversation emphasizes the importance of using simpler functions, like bicubic interpolation, over finer grids for improved results.
confused_engineer
Messages
34
Reaction score
1
TL;DR Summary
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: 166
  • 1a_original.jpg
    1a_original.jpg
    11.3 KB · Views: 161
  • Like
Likes confused_engineer
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 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 BvU
  • Like
Likes BvU

Similar threads

Back
Top