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 for Programming
 Forum for Origin C
 Simple code for obtaining first derivative
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Wendy_Yang

USA
Posts

Posted - 05/15/2009 :  3:53:08 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): Origin7 SR4
Operating System: Windows XP

I would like to differentaite one dataset and write the result into a new dataset. How do I write the codes in OriginC? For example, I have a worksheet named "Data1". There are 3 columns: X, Y and Deriv. I have X and Y filled with data, and would like to differentiate Y and put the derivative data in Deriv. So I start with:

Dataset dsX("Data1_X");
Dataset dsY("Data1_Y");
Dataset dsDeriv("Data1_Deriv");

How do I proceed from there? By the way, the codes need to be part of a user-defined function.

Thanks!

Iris_Bai

China
Posts

Posted - 05/27/2009 :  02:21:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Wendy,

In Origin7 you can use this function

int Curve_derivative( curvebase * pcrvData, curvebase * pcrvResults, int nOrder = 1, double dSmoothness = BSPLN_OFF, Dataset * pdsWeights = NULL )


Example code:

void test_Curve_derivative()
{
	Curve crvData("Data1_X", "Data1_Y");
	Curve crvResult("Data1_X", "Data1_Deriv");
	crvResult.SetSize(crvData.GetSize());
	
	int nOrder = 1;
	Curve_derivative(&crvData, &crvResult, nOrder);	
}


Iris
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