Message Boards Message Boards

0
|
2780 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Plot an output constructed using a table?

Posted 4 years ago

Hello everyone. I have constructed a Mathematica output that constructs a Shannon interpolation for different data stored in a vector using the following command:

savedX = Table[XposX = aaa[[All, 1]]; YposX = aaa[[All, 2]]; 
   windXVal = aaa[[All, i]];
   windXMat = Transpose[{XposX, YposX, windXVal}];
   ifuncEPSX = Interpolation[windXMat //. {x_List} :> x];
   intDataVectorEPSX = 
    Flatten[Table[{t, u, ifuncEPSX[t, u]}, {t, xmin, xmax, 
       dDeltaX}, {u, ymin, ymax, dDeltaY}]];
   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[t_, u_] = 
    Total[#3*sinc[(t - #1)/dDeltaX]*sinc[(u - #2)/dDeltaY] & @@@ 
      interpolatedDataEPSX], {i, 3, countMax + 2}];

Then, if I write savedX[[2]] , I get the following

12.9185 Sinc[0.20944 (0. + t)] Sinc[0.448799 (-65. + u)] + 
 7.97354 Sinc[0.20944 (15. + t)] Sinc[0.448799 (-65. + u)] 

If I write ContourPlot[ savedX[[2]][t, u], {t, xmin, xmax}, {u, ymin, ymax}, GridLines -> {{xmax, xmin}, None}, PlotLegends -> Automatic], then the resulting output is an empty map.

If in the previous code I wrote

shannonInterpolation[t_, u_]=Total[#3*sinc[(t - #1)/dDeltaX]*sinc[(u - #2)/dDeltaY] & @@@ 
interpolatedDataEPSX]

and

ContourPlot[
 shannonInterpolationWindX[t, u], {t, xmin, xmax}, {u, ymin, ymax}, 
 GridLines -> {{xmax, xmin}, None}, PlotLegends -> Automatic]

Then I get the result I want (see attached fileenter image description here)

I am not too familiar with Mathematica, but I see that in this second case, that works, the output looks like Sinc[0.20944 (0. + t_)], the letter t has a '_' behind and this is probably the source of my issue.

Can someone please tell me how to be able to plot the elements of savedX? Any answer is welcome. Regards. Jaime.

POSTED BY: Jaime de la Mota
2 Replies
Posted 4 years ago

The posted code and output do not match. e.g. code uses sinc and the output has Sinc.

The definitions for shannonInterpolationWindX[t_, u_] and shannonInterpolation[t_, u_] are identical.

With the posted code I don't see any way a t_ could appear in the output.

There are many undefined symbols in the posted code, so it is impossible to run it and reproduce your results.

POSTED BY: Rohit Namjoshi

Hello Rohit. First of all, thanks for your answer. Sinc is a mathematica function, while I have defined sinc as sinc = Sinc[Pi #] & ; I am then attaching the code then in case it can be useful. Regards.

Attachments:
POSTED BY: Jaime de la Mota
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract