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
 Declaring partial derives in NLSF

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
gbellidograins Posted - 04/08/2008 : 4:29:04 PM
Origin Version (Select Help-->About Origin): 7.5
Operating System: Windows XP

I have successfully defined my own fitting function based on the information contained in the NLSF Wizard of Origin 7.5. However, the time ORIGIN takes to perform the iterative analysis is unduly long. I read in the HELP menu that this can be solved by declaring the partial derivatives of my fitting function with respect to all fitting parameters. Since I am new to the NLSF programming language I don't know how (and where)to declare such partial derivatives (I do have them). When I added the equations after I declared my fitting function in C CODE builder, the fitting function program could not be compiled. This info is not in the HELP menu.

Thank you.
2   L A T E S T    R E P L I E S    (Newest First)
gbellidograins Posted - 04/09/2008 : 12:58:10 PM
Hi Echo,

Thank you so much for the reply. Your recommendation was actually useful. I must confess, though, that the solution is not trivial when one uses two or more functions to describe an experimental curve (i.e., when one uses the conditional "If" and "else"). In such cases the program will only run if each of the declared functions and its corresponding derivatives are declared between brackets. For instance, for two functions similar in form to the one you suggested an analogous situation to the one I encountered will be solved as follows:
if ( x < P1)
{
y = P1 + P2 * x + exp(P3 * x);
dy_P1 = 1;
dy_P2 = x;
dy_P3 = x * exp(P3 * x);
}
else
{
y = P1 - P2 * x - exp(P3 * x);
dy_P1 = 1;
dy_P2 = -x;
dy_P3 = -x * exp(P3 * x);
};

Hope this helps other people out there with a similar problem.

gbellidograins
Echo_Chu Posted - 04/09/2008 : 05:46:39 AM
Hi,

Please look at following steps as an example
1. Open NLSF dialog
2. Select Function:New
3. Change Number of Parameters as 3. Select Derivative check box
4. Type following equation and derivative definition in Functon Definition Text box. Please note that each definition should be seperated by semicolon

y = P1 + P2 * x + exp(P3 * x); //User-defined equation
dy_P1 = 1; //Derivative definition of P1
dy_P2 = x; //Derivative definition of P2
dy_P3 = x * exp(P3 * x);//Derivative definition of P3;


5. Click Edit in Code Builder button to make sure the code and be successfully compiled in code builder
6. Save the Function.

If your new derivative equation fail to compile in Step5. It might because equation is not correct in OC format. Would you mind to show us your codes in Functon Definition Text box.


Echo
OriginLab Corp


Edited by - Echo_Chu on 04/09/2008 05:53:55 AM

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