MATRIXx

cancel
Showing results for 
Search instead for 
Did you mean: 

Linear Interpolation

Hello,

I have a prob.
I have 3 columns in a table which i have to interpolate to get the output.. plzz help me finding out how to use the pallete linear interpolation in matrix x
TIA
-Supha
0 Kudos
Message 1 of 7
(12,509 Views)
Hi Supha,

When you say you have three columns, do you mean you use the same input to generate three output numbers, or you have 2 inputs that determine xy coordinates in a surface defined by the three columns?

The LinearInterp block for example, takes two arrays as configuration. You configure how inputs map to outputs. So if your input array is (-1.0, -0.5, 0, 0.5, 1.0)
And your output is (-1.0, -0.5, 0, 1.0, 2.0) you will notice the icon changges. It shows a slope of 1 for points betweer -1 and -0.5. For points bigger than -0.5, the slope doubles. So, if you input 0.8, you will return 1.6.

Please clarify the problem of interpolation further so I can better help you.

Richard

Field Sales Engineer, New Jersey
National Instruments
0 Kudos
Message 2 of 7
(12,497 Views)
Hello,

I was searching in the forum for a solution for my problem and I've found this post. I don't know what was exactly the problem that supha had but mine is very similar.
In a few words I have a matrix of constants made in the following way: the first column contains n frequencies' values and teh next 16 columns contain the corresponding values of amplitude for 16 different pressure probes.
I need to interpolate in the whole matrix to find the values of the pressure amplitude for all the probes, given a particular frequency value. I'd like to obtain as an output a vector of 17 elements: the assigned frequency and the corresponding interpolated values of probes' amplitudes.

I hope I have been clear enough
thanks in advance

Robbo
0 Kudos
Message 3 of 7
(11,334 Views)
Hello RobboFlea,
I am not sure if I am understanding your question, but I think it would make more sense to store this data as a Parameter-Dependent Matrix (PDM).  As a PDM, frequency would be your domain, and you could have your pressures as the columns.  Then you can just use the interpolate function with a new domain and it will do all the work for you.  Here's an example of something I tried.
 
fre=[10;20;30;40;50];
p1=[0.1;0.2;0.3;0.4;0.5];
p2=3*p1;
p3=p2-.1;
p4=p3*2+.5;
mypdm=pdm([p1,p2,p3,p4],fre)
mypdm (a pdm) =
domain |   Col 1  Col 2  Col 3  Col 4
-------+-----------------------------
    10 |   0.1    0.3    0.2    0.9 
    20 |   0.2    0.6    0.5    1.5 
    30 |   0.3    0.9    0.8    2.1 
    40 |   0.4    1.2    1.1    2.7 
    50 |   0.5    1.5    1.4    3.3 

myinterpolation=interpolate(mypdm,25)
myinterpolation (a pdm) =
domain |   Col 1  Col 2  Col 3  Col 4
-------+-----------------------------
    25 |   0.25   0.75   0.65   1.8 
 
The formatting is a little off, but if you try it out, you can see what it does.  The beauty of this is that your second domain can be more than a single value.
 
Hope this helps, please post back if you have more questions about this.
Regards,
Angela M
Product Support Engineer
Message 4 of 7
(11,325 Views)
Yes the problem was exactly that you've solved...or maybe that you were near to solveSmiley Wink.
Unfortunately I don't manage to find something in Labview's help that could help me using this kind ot data store (PDM). To be more precise i've found no results searching for "PDM" or similars in the help index.
I'm using labview 8.0. it could be a problem due to my version? The other problem I have is that I have to import this matrix from a spreadsheet file. I cannot build it internally in the way you said

...mypdm=pdm([p1,p2,p3,p4],fre)...

Is there a wai to import a matrix and then say that the first column has to be the columnn of independent variables of a PDM and the remaining columns are the columns of dependent parameters?

thanks for your help

Robbo
0 Kudos
Message 5 of 7
(11,319 Views)
Hello Robbo,
You have posted your question to the MATRIXx forum which is a different product than LabVIEW.  My response was to how you could do this in MATRIXx, for this and all future questions about LabVIEW I suggest you post to the LabVIEW forum.  There is a large LabVIEW community that can help you with your questions.  Keep an eye on the banner at the top of the forum thread to know which forum you are in.  You can see the list of all our forums at http://forums.ni.com/.
 
Sorry for the confusion.
 
Regards,
Angela M
Product Support Engineer
Message 6 of 7
(11,315 Views)
Pardon! it was my fault! I'm new to this forum and I've not given attention to the banner.
Thanks however

Robbo
0 Kudos
Message 7 of 7
(11,306 Views)