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
 Nonlinear fit
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

zlostar

1 Posts

Posted - 12/06/2008 :  10:50:47 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver.8G and SR 4
Operating System: xp SR2

Hi all,

I want to make two nonlinear curves with the equations
y = B*x - B*C*x^2 and
y = (C*x)/(1 + A*x),
where A, B and C are parameters, but
I have no Idea what will the C-Code look like?

Can somebody help me??

Iris_Bai

China
Posts

Posted - 12/10/2008 :  02:49:19 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

In Origin C, vector support do calculation with operator +, -, *, /, ^. See the following example:


void calculate(vector& vx, vector& vy, double B, double C)
{	
	vy = B*vx - B*C*vx^2;	
}

void testOK()
{
	Worksheet wks;
	wks.Create("origin");
	
	Dataset dsX(wks, 0);
	Dataset dsY(wks, 1);
	dsX.Data(1, 10, 1); // set data from 1 to 10 with 1 increment
	
	calculate(dsX, dsY, 0.5, 1);
	
	GraphPage gp;
	gp.Create("origin");
	GraphLayer gl = gp.Layers(0);
	gl.AddPlot(wks);
}


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