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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Parameter Initialization Problem

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
cjk209 Posted - 02/21/2014 : 6:26:53 PM
Origin Ver. and Service Release (Select Help-->About Origin): 9.0.0 SR2
Operating System: Windows 7

I am having great difficulty figuring out how to use Origin C to get the correct parameter initialization I need. I have very little experience with the C language.

So I have defined a user fitting function, say y = A*exp(k*x) and I have specified both A and k as parameters while x is my independent variable. In the Function Builder, under the Parameters tab I have specified k = 1 for initial value (not fixed) and A = "--" (nothing) and is fixed. I need parameter A to initialize as the 'yatxmax' value of my X&Y data of the active worksheet, but once it initializes it needs to become a fixed parameter.

Thus, for my initialization code I have tried the following:

Curve crv("Data1_A","Data1_B"); //hopefully this is the right code that says 'use data from column A and column B in active worksheet'
A = yatxmax(crv); //this should initialize A as yatxmax


Of course this doesn't work...It tells me that A is not properly initialized. That is probably because I used a "--" as the value in the Parameters tab. If I input a value in the Parameters tab it overrides the "yatxmax" initialization.

Is there some way I can use the initialization code to fix this parameter after 'yatxmax' initialization without checking the "Fixed" box in the Parameters tab in Function Builder?

Thanks for any help!



2   L A T E S T    R E P L I E S    (Newest First)
cjk209 Posted - 03/16/2014 : 5:08:28 PM
Thank you!!!
greg Posted - 02/25/2014 : 12:19:58 PM
You are over-thinking the fitting process. The fitter assigns the variables to the data so there is no need to hard-code a constructed curve:
Curve crv("Data1_A","Data1_B");

Within the fitter, we make available both the variables:
x_data, y_data
and the curve:
x_y_curve
which you can use within parameter initialization as needed.

We already have your function built-in ( Exp2PMod1 ), but your 'k' is our 'b'. Defining a function your way, with your parameter names makes sense, but you don't need to redefine the wheel since you can copy the Parameter Initialization code from Exp2PMod1:

int sign;
b = get_exponent(x_data, y_data, NULL, &a, &sign);
a = sign * exp(a);

and make a few small changes:

int sign;
k = get_exponent(x_data, y_data, NULL, &A, &sign);
A = sign * exp(A);

Note that C is case sensitive, so x, y, A and k case must match your definition. The above initialization code includes three instances of 'A' for example.

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000