LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Matlab - MathScript functions differences (interp1 vs interpolate1d)

Solved!
Go to solution

Hello,

I'm trying to use Matlab script in my app. I'm using interp1(x,v,xq,method,extrapolation) Matlab function in it.

 

If I use MathScript Node, it returns an error "You specified an invalid number of input parameters for this function."

LabVIEW help is saying that interp1 do not have extrapolation argument and also that it is only possible to use cubic, linear, nearest or spline as method value.

 

I understand that basically MathScript and Matlab is not the same but if documentation is saying that Matlab interp1 equivalent for MathScript is interpolate1d (officially interpolate1d but interp1 is also working) then it is covering all the original functionality or only some parts? If the latter is true, how to find the differences?

 

Matlab help is saying that interp1 can have linear, nearest, next, previous, pchip, cubic, v5cubic, makima or spline as method value.

I checked all of them and it turns out that pchip and v5cubic are also allowed values in MathScript!

But is this really working?

 

Matlab documentation is saying also that if you specify the 'pchip', 'spline', or 'makima' interpolation methods, then the default behavior of extrapolation is 'extrap'.

So what will happen if I run interp1 with method = 'pchip' and not assigned extrapolation?

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 1 of 2
(5,943 Views)
Solution
Accepted by topic author bienieck

Extrapolation is default for all methods and available methods are cubic, linear, nearest, spline, pchip and v5cubic (can be checked in [LabVIEW]\vi.lib\imath\engines\lvmath2\RunTimeEngine\BuiltInFunctions\interpolate1d).

NI has incomplete documentation.

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 2 of 2
(5,891 Views)