# Can I improve the sinc interpolation?

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:

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]], {i, 1, leEPSX - 2, 3}];
vectorYintEPSX =
Table[intDataVectorEPSX[[i]], {i, 2, leEPSX - 1, 3}];
vectorFintEPSX = Table[intDataVectorEPSX[[i]], {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]

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.

Best regards.
confused_engineer.

#### Attachments

• mathematica_code.txt
3.8 KB · Views: 5
• Xnodo_1_of_16.txt
10.4 KB · Views: 5
• Ynodo_1_of_16.txt
10.7 KB · Views: 6
Last edited:

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.

Best regards.
Confused engineer.

#### Attachments

• confused_engineer
pbuk
Gold Member
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).

• pbuk
Gold Member
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.

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:
• BvU
berkeman
Mentor
• BvU