DIAdem Help

Content Type
Programming Language
Current manual
Table of Contents

Command: ChnApprYCalc

Display all  Hide all

Command: ChnApprYCalc

Approximates a signal.

Set ChnResult = ChnApprYCalc(XW, Y, SamplingPointChn, ResultChannel)

Input Parameters

XW Specifies the data channel that contains the x-values of the signal. If the associated y-channel is a waveform channel, you do not need to specify this channel.
Y Specifies the data channel that contains the y-values of the signal.
SamplingPointChn Specifies the data channel containing the interpolation points.
ResultChannel Specifies the result channel containing the y-values of the approximation function.

Return Parameters

ChnResult Contains the result channel containing the y-values of the approximation function. ElementList <Data> type return value.
Note  If you want to use waveform channels in this command, follow Rule 2.2 for Calculating with Waveform Channels.

Global Parameters 

ApprAnsatzFct(i)Specifies the function terms for the setup function.

Return Parameters 

ApprAnsatzCoef(i)Receives the coefficients of the setup function.
ApprPrecisionReceives the coefficient of determination of an approximation.
Note  The values in the x-channel must be monotone increasing.

DIAdem approximates the signal with a function that contains a linear combination of individual and independent setup functions. DIAdem first calculates the coefficients of the function. DIAdem then evaluates the calculated approximation function in the x-range specified by the XChnNo interpolation points channel.

DIAdem uses the Gauss method of least squares for approximation.

Note  If the selected setup function results in a curve that deviates substantially from the exact solution, DIAdem displays an error message.
Note  The ApprAnsatzOff command clears the checkboxes for the selected setup function terms.
Refer to the Help page Approximation for further information.

Examples

The following example calculates an approximation with the a1+a2*x+a3*x^2 setup function. DIAdem saves the results of the evaluation of the approximation function for the specified interpolation points channel in the Results channel group. The input channels are accessed through channel objects.

VBScriptPython

 

Dim oMyGroup, oMyXChannel, oMyYChannel, oMyY1Channel, oMyResultChn
Call ApprAnsatzOff                   ' Deactivates all function terms
ApprAnsatzFct(1) = "Yes"             ' Activates function term constant
ApprAnsatzFct(2) = "Yes"             ' Activates function term x
ApprAnsatzFct(3) = "Yes"             ' Activates function term x^2
Set oMyXChannel = Data.Root.ChannelGroups(1).Channels(1)
Set oMyYChannel = Data.Root.ChannelGroups(1).Channels(2)
Set oMyY1Channel = Data.Root.ChannelGroups(1).Channels(3)
Set oMyResultChn = ChnApprYCalc(oMyXChannel, oMyYChannel, oMyY1Channel, "Results/ApproximatedY")
Call MsgBox("Result channel: " & oMyResultChn(1).ChannelGroup.Name & "/" & oMyResultChn(1).Name)

The following example calculates an approximation with the a1+a2*x+a3*x^2 setup function. DIAdem saves the results of the evaluation of the approximation function for the specified interpolation points channel in the Results channel group. The input channels are accessed through the channel reference.

VBScriptPython

 

Dim oMyResultChn
Call ApprAnsatzOff                   ' Deactivates all function terms
ApprAnsatzFct(1) = "Yes"             ' Activates function term constant
ApprAnsatzFct(2) = "Yes"             ' Activates function term x
ApprAnsatzFct(3) = "Yes"             ' Activates function term x^2
Set oMyResultChn = ChnApprYCalc("[1]/[1]","[1]/[2]","[1]/[3]","Results/ApproximatedY")
Call MsgBox("Result channel: " & oMyResultChn(1).ChannelGroup.Name & "/" & oMyResultChn(1).Name)

Dialog Box Call

Call SUDDlgShow("Main", ResourceDrv & "AnaChnApprCalc")

Approximate

Related Topics

Command: ChnAkimaXYCalc | Command: ChnAkimaYCalc | Command: ChnApprXYCalc | Command: ChnEnvelopes | Command: ChnGaussFitXY | Command: ChnGaussFitXYWeighted | Command: ChnGaussFitY | Command: ChnGaussFitYWeighted | Command: ChnGenLSFit | Command: ChnGenLSFitWeighted | Command: ChnNonLinearFitXY | Command: ChnNonLinearFitXYWeighted | Command: ChnNonLinearFitY | Command: ChnNonLinearFitYWeighted | Command: ChnRegrXYCalc | Command: ChnRegrYCalc | Command: ChnSavitzkyGolayFilter | Command: ChnSavitzkyGolayFilterWeighted | Command: ChnSmooth | Command: ChnSplinePara | Command: ChnSplineXYCalc | Command: ChnSplineYCalc | Command: CircleConcCalc | Command: CircleExtremeCalc | Command: CircleRegrCalc

Was this information helpful?