LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid number of input variables in mathscript

In LabVIEW, I have a problem where I try to solve four linear equations with "linearsolve" command. I have two input signals from the DAQ assistant which I convert from a dynamic system to a numeric array.

When I try to solve the equations in the Mathscript it says "Error -90051 occurred at Error in function linearsolve at line 13: You specified an invalid number of input parameters for this function."

I have not been able to find help anywhere in other forums other than one place where it suddenly worked again. 

 

I have attached a picture of the block diagram and the error. 

Hope someone can help me solve this problem.

Download All
0 Kudos
Message 1 of 10
(6,122 Views)

Showing us a picture of your code that we cannot modify, or try to run ourselves, makes it more difficult for us to help you (imagine that I asked you for help with a Matlab routine and attached a picture of a 3-page printout of its listing).

 

Attach your VI!

 

The error message suggests the problem is in "linearsolve", whatever that is.  Have you looked into that?

 

Bob Schor

0 Kudos
Message 2 of 10
(6,108 Views)

Some of your parameters seem to have higher dimensions. What are you actually trying to achieve with all this? Can you take a step back and explain what the data represents and what you are trying to get out of it? I doubt that you need to use mathscript at all. (hint!)

 

Did you look at the help page for the function? 

 

Why did you wire charts to the 2D array output? Why are there so many coercion dots? Do you know the difference between charts and graphs?

0 Kudos
Message 3 of 10
(6,082 Views)

Oh sorry about that. The VI is attached now. 

 

Yes, we have looked into the linearsolve, but we can't seem to figure out what the problem is. We are trying to solve the four equations with four unknowns, and linearsolve is the only function that solves linear equations as far as I understand.

 

Oscar Lyhne

0 Kudos
Message 4 of 10
(6,052 Views)

We are trying to do forward kinematics for a two-dimensional platform. We have a potentiometer output in voltage which we are converting to an mm output, which is why we have the coercion dots. These two lengths are the input for the mathscript. 

The output is then the angle and movement in the y-direction of the platform. 

 

As I understand the mathscript has to have a numeric input which is why we are converting the dynamic data.

 

The VI is attached to the answer from Bob.


I am really grateful for the help from both of you, but I am quite new at LabView so I really appreciate your help!

0 Kudos
Message 5 of 10
(6,050 Views)

I don't have MathScript installed, and I don't know what "linearsolve" does nor what its parameters mean -- the error you are seeing suggests that you are calling it improperly. 

 

There are equation-solvers and curve-fitters in LabVIEW that don't require "mystery functions".

 

Bob Schor

0 Kudos
Message 6 of 10
(6,036 Views)

I can see I am not the only one who has problems with the mathscript, so I have tried a different method now. 

 

I see that other people are using nD nonlinear system solver for solving similar kinds of problems. But I have a really hard time making it work. I keep getting error -23001 which, as far as I understand, is a syntax error.

Also, I can't figure out how it is possible to have two variable lengths in the function.

The length of the legs will vary (L1 and L2) and are the outputs from the DAQ Assistant. 

 

The four equations are:

(L1+125*sin(theta))-H1 = 0

(350-250*cos(theta))-L5 = 0

arcsin((L2*cos(phi)-L1)/L2)-theta = 0

arcsin(L5/L2)-phi = 0

 

I have attached the VI

0 Kudos
Message 7 of 10
(6,021 Views)

Can you fill all your controls with reasonable default data*? (most are currently empty arrays!)

 

*(enter all values, menu ... edit ... make current values default...save and attach once more.)

0 Kudos
Message 8 of 10
(6,016 Views)

Sorry about that. Here it is with the values in arrays.

0 Kudos
Message 9 of 10
(6,011 Views)

I'll have a look at it tomorrow, but make sure to read this page.

0 Kudos
Message 10 of 10
(6,004 Views)