The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Differentiate Gadget Questions
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cdrozdowski111

USA
247 Posts

Posted - 05/26/2014 :  05:59:47 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 9.1 SR2 64-bit/32-bit, Win7 Pro 64-bit, running in VMware Fusion 5.0.4

I some questions about the Differentiate Gadget. I looked in the docs but didn't see the answer and wasn't able to 100% determine the answers myself.

Setup:

In the Differentiate Gadget dialog, specify 1st order derivative and S-G smoothing. Then in the flyout menu, you check "Show 2nd Derivative".

Questions:

1) Does the gadget use the smoothed 1st-order derivative data to calculate the 2nd-order derivative data?
2) Is the 2nd-order derivative data smoothed itself?


Also (without regard to smoothing), is there any true difference in outcome between:

1) Setting 1st order derivative in the dialog and "Show 2nd Derivative" in the flyout.
and
2) Setting 2nd order derivative in the dialog and "Show 1st Derivative" in the flyout.

Castiel

343 Posts

Posted - 05/26/2014 :  1:10:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by cdrozdowski111

OriginPro 9.1 SR2 64-bit/32-bit, Win7 Pro 64-bit, running in VMware Fusion 5.0.4

I some questions about the Differentiate Gadget. I looked in the docs but didn't see the answer and wasn't able to 100% determine the answers myself.

Setup:

In the Differentiate Gadget dialog, specify 1st order derivative and S-G smoothing. Then in the flyout menu, you check "Show 2nd Derivative".

Questions:

1) Does the gadget use the smoothed 1st-order derivative data to calculate the 2nd-order derivative data?
2) Is the 2nd-order derivative data smoothed itself?


Also (without regard to smoothing), is there any true difference in outcome between:

1) Setting 1st order derivative in the dialog and "Show 2nd Derivative" in the flyout.
and
2) Setting 2nd order derivative in the dialog and "Show 1st Derivative" in the flyout.



Just checked the XFC file quickly....

For the first two:

m_vDerivY = m_vY;
m_v1stDerivY = m_v2ndDerivY = m_vY;
//..
ocmath_savitsky_golay_derivative(m_vX, m_vY, m_vDerivY, m_vX.GetSize(), nPts/2, -1, nPolyOrder, nOrder);
ocmath_savitsky_golay_derivative(m_vX, m_vY, m_v1stDerivY, m_vX.GetSize(), nPts/2, -1, nPolyOrder, 1);
ocmath_savitsky_golay_derivative(m_vX, m_vY, m_v2ndDerivY, m_vX.GetSize(), nPts/2, -1, nPolyOrder, 2);

Well, few documentation on this function, except:
OCMATH_API int ocmath_savitsky_golay_derivative(double *px, double *py, double *pSmooth, UINT nSize, int nLeftpts, int nRightpts = -1, UINT nPolydeg = 2, UINT nDervOrder = 1, bool bSmoothPeakPoint = false);



For the latter two:

m_vDerivY = m_vY;
//...
for ( int iOrder = 1; iOrder <= nOrder; iOrder++ )
{
    if ( OE_NOERROR != ocmath_derivative(m_vX, m_vDerivY, m_vX.GetSize()) )
    {
        return error_report("Differentiate fail.");
    }
    if ( 1 == iOrder )
        m_v1stDerivY = m_vDerivY;
    else if ( 2 == iOrder )
        m_v2ndDerivY = m_vDerivY;
}
if ( nOrder < 2 )
{
    m_v2ndDerivY = m_v1stDerivY;
    if ( OE_NOERROR != ocmath_derivative(m_vX, m_v2ndDerivY, m_vX.GetSize()) )
    {
        return error_report("Differentiate fail.");
    }
}

later on, m_v1stDerivY and m_v2ndDerivY are used in updatePreviewGraphs(), being stored in workbook "wDerivative". In a word, no difference.

妾+   午旦  妹罕妾  妾伊    用仇  妾/     岫ㄞ
 妾京用 仍巨  件 侈   件戶' 甘岫平   /欠  白岫妹
   併             艮          岫  奈 白   岫
                              岫
Go to Top of Page

cdrozdowski111

USA
247 Posts

Posted - 05/26/2014 :  3:07:05 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for taking the time to dig that code out.

You answered my questions quite well!
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000