Command: ChnApprYCalc
- Updated2024-09-12
- 5 minute(s) read
Command: ChnApprYCalc
Command: ChnApprYCalc
Approximates a signal.
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. |
![]() |
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
![]() | Specifies the function terms for the setup function. |
Return Parameters
![]() | Receives the coefficients of the setup function. |
![]() | Receives 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.
VBScript | Python |
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.
VBScript | Python |
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
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