LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

integration function

I am a user of LabVIEW 8.0.
 
I want to integrate a function(x^2) of x from 0 to 1.
 
Is it possible by mathscript?
 
Please refer to the attatched file.
0 Kudos
Message 1 of 4
(7,947 Views)
Hello,

In your attached file, you are attempting to perform an integration with a symbolic variable.  Unfortunately, MathScript does not support symbolic mathematics at this time.  MathScript does support the trapz numerical integration function.  You will first need to create a vector of evaluations of your function of interest.  We are considering adding additional integration functions in a future release of LabVIEW.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 2 of 4
(7,931 Views)
>>help trapz
trapz (MathScript Function)
Member of the vector class.
 
Hi Grant & zolaman 
 
Am I missing something here? Have a look MatScript trapz help below 
 
 
 
 
Syntax
c = trapz(y)
c = trapz(x, y)
 
Description
Computes numerical integration using the trapezoidal method.
Inputs
x - Specifies the x-values of the function that you want to integrate. x is a vector.
y - Specifies the y-values of the function that you want to integrate. y is a vector or matrix of the same size as x. If y is a matrix, c returns the integrals of all columns of y.
Outputs
c - Returns the numerical integration of y. c is a scalar or vector.
Examples
Y = [0, 1, 2, 3, 4]
C = trapz(Y)
Related Topics
cumsum
sum
0 Kudos
Message 3 of 4
(7,927 Views)
Hello Blue_Math,

Well, as I mentioned, MathScript does support the trapz function.  However, this is a numerical integration function and it looks like zolaman wanted to perform a symbolic integration.  For the particular function mentioned (x^2), the numerical approximation will be reasonably accurate.  We simply need to evaluate the function over the points of interest.  For example,

x = linspace(0, 1);
y = x.^2;
A = trapz(x, y)


Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 4 of 4
(7,909 Views)