Can I improve the sinc interpolation?

In summary, the individual is looking for alternative methods for interpolating data in order to obtain a more accurate result with fewer terms. They have tried using Shannon interpolation with 6400 terms but it did not provide satisfactory results. They are seeking alternative methods such as those listed in the '2 dimensions' section of the Wikipedia page on multivariate interpolation.
  • #1
confused_engineer
39
2
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:

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.

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

Attachments

  • mathematica_code.txt
    3.8 KB · Views: 117
  • Xnodo_1_of_16.txt
    10.4 KB · Views: 125
  • Ynodo_1_of_16.txt
    10.7 KB · Views: 147
Last edited:
Technology news on Phys.org
  • #2
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: 98
  • 1a_original.jpg
    1a_original.jpg
    11.3 KB · Views: 100
  • #5
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
  • #6
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
  • #7
  • Like
Likes BvU

1. What is sinc interpolation and why is it important?

Sinc interpolation is a mathematical method used to reconstruct a continuous signal from a sampled signal. It is important because it allows for accurate representation of signals and is commonly used in fields such as signal processing, image processing, and data compression.

2. Can I improve the accuracy of sinc interpolation?

Yes, there are several ways to improve the accuracy of sinc interpolation. One method is to increase the sampling rate, which leads to a higher number of samples and therefore a more accurate reconstruction. Additionally, using a higher-order interpolation formula can also improve accuracy.

3. Is there a trade-off between accuracy and computation time in sinc interpolation?

Yes, there is typically a trade-off between accuracy and computation time in sinc interpolation. As mentioned before, increasing the sampling rate and using a higher-order interpolation formula can improve accuracy, but it also requires more computation time. On the other hand, using a lower-order interpolation formula may decrease computation time but at the cost of accuracy.

4. Can I improve the performance of sinc interpolation for non-uniformly spaced data?

Yes, there are methods for improving the performance of sinc interpolation for non-uniformly spaced data. One approach is to use a weighted interpolation formula that assigns different weights to each data point based on its distance from the desired interpolation point. This can lead to better accuracy for non-uniform data.

5. Are there any limitations to improving sinc interpolation?

Yes, there are limitations to improving sinc interpolation. While increasing the sampling rate can improve accuracy, it also comes with a higher computational cost. Additionally, sinc interpolation may not be suitable for highly complex signals or data sets with a large number of outliers, which can affect the accuracy of the interpolation.

Similar threads

  • Programming and Computer Science
Replies
1
Views
2K
Back
Top