LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding Error Using Partial Derivatives

I'm currently writing an application that will need to be able to calculate the absolute errors of different tests being done in a lab. I want to be able to do this using only the various accuracies of equipment being used and the equation being used to turn all of the inputs of that data into the output that we want.

I will be using the equation for error that is absolute error=sqrt(partial derivatives^2*(tolerance of equipment)...)

There is a very easy way to do this using matlab, but my company doesn't have matlab software so I'm going to have to do without it.

The only solution I've come up with thus far is *possibly* export the data to excel and then write a vba script that would calculate the partial derivatives for me (shouldn't be too difficult but it may be tedious). Is there any simpler/more elegant way of doing this in LabView?

Thanks for your help
0 Kudos
Message 1 of 6
(9,088 Views)
Hello,

You can try running your script with LabVIEW MathScript.  In LabVIEW MathScript, you generally can execute scripts written in the MATLAB® language syntax.  However, the MathScript engine executes the scripts, and the MathScript engine does not support some functions that the MATLAB engine supports.

You can launch the interactive MathScript Window by going to Tools >> MathScript Window.  Alternatively, you can use the MathScript Node inline with the rest of your LabVIEW code.  It is available on the Structures palette.

MATLAB® is a registered trademark of The MathWorks, Inc.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 2 of 6
(9,081 Views)
I tried putting in my syntax as I would in matlab and ended up with non-sensical answers whenever I tried to differentiate equations. Maybe my syntax is wrong?

syms a b;
f=ba^2;
dfdb=diff(f,b);

My dfdb would always come out to 0.

That being said I'm pretty sure mathscript doesn't support differentiating, after going through the labview website and seeing the functions supported. Any other suggestions?
0 Kudos
Message 3 of 6
(9,078 Views)
(nevermind)

Message Edited by altenbach on 06-27-2007 11:20 PM

0 Kudos
Message 4 of 6
(9,063 Views)
Hello,

As for the syntax, I believe your second line should be
f = b*a^2;
Unfortunately, LabVIEW MathScript does not support the syms command.  In LabVIEW 8.2, the MathScript Node did not have automatic error handling.  So, if you did not wire the error out terminal from the node, you would not see an error in the script.

While MathScript does not support symbolic differentiation, you can always compute the partial derivative yourself and write the function to call to evaluate it.  For example:
function y = dfdb(a)
y = a^2;


Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 5 of 6
(9,057 Views)
Thanks, I think that's what I'm going to do for now. I was just looking for a solution that would allow the computer to compute the derivatives itself to make it more versatile and the code more reusable.
0 Kudos
Message 6 of 6
(9,054 Views)