T O P I C R E V I E W |
DrWhereItsAt |
Posted - 02/07/2012 : 10:12:59 PM I'm trying to define a custom function which includes the inverse hyperbolic tan (atanh or arctanh) to fit my data, however Origin seems not to know this function. It would be hugely helpful if I could define atanh as a function that Origin recognises (like ln or exp) and then use it in my custom function, otherwise my custom function starts to get rather unwieldy. Is there a way to do this?
Secondly, having read some info available on this forum (chiefly http://www.originlab.com/forum/topic.asp?TOPIC_ID=6849]here), I see that you can use Origin's custom function organiser to call functions defined in external files, such as in GNU's Scientific Library (where there is an entry for arctanh). However, the links in that post are empty. Could someone please provide some guidance or fresh links on how to define a function in the function organiser that calls functions defined elsewhere?
My aim is to get this function set up so I can simulate/fit my data using arctanh, so I'd be grateful for help to do it using either of these two potential methods.
Cheers!
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 8.0.63.988 SR6 Operating System: Windows XP Service Pack 3
|
3 L A T E S T R E P L I E S (Newest First) |
Penn |
Posted - 02/08/2012 : 9:25:05 PM Hi,
Here is the simple example about how I use the atanh in user-defined fitting function.
1. Open the Fitting Function Organizer and create a new fitting function. In the Function section, add the following code (just a simple example).
y = A * atanh(x);
2. Click the button beside the text box to open the Code Builder.
3. In Code Builder, if I click the compile button directly, there will be some compilation error message to tell atanh is not found.
4. Then add the declaration after the line #include <origin.h>, as the image shows below.
5. Compile again, it succeeds.
Hope that you can repeat these steps. If not, better that you can provide your steps.
Penn |
DrWhereItsAt |
Posted - 02/08/2012 : 5:46:50 PM Hmm, thanks, I'm still stuck, but I'm starting to get somewhere!
So far I have been trying to define the function using the Fitting Function Organizer. Neither in there, nor in the Code Builder (button next to Function box) is atanh recognised. Adding the line that you gave me doesn't seem to help - it cannot compile as it doesn't recognise atanh. Where in the code should I put that declaration? As another dependent variable? Using the Code Builder in the Fitting Function Organizer only gives me a few places I can add to, and those don't seem to work. If I make a .c file with the Code Builder outside of the Fitting Function Organizer then I can put that atanh line in, but then how do I make the resulting .c file into a fitting function file that the Organizer recognises?
I have also looked at the tutorial link you posted. If is for an equation including an integral, but none of the code is explained and it is very hard to work out what any of it means. Is there a guide or some simpler examples that you could please point me too until I can understand the basics?
Thanks for the help so far - I thought atanh would be a common enough function that I wouldn't need to work out how to program in Origin to fit a set of data to it! |
Penn |
Posted - 02/08/2012 : 01:38:13 AM Hi,
Actually, Origin has defined the inverse hyperbolic tan function. The prototype is
double atanh(double x);
So, if you want to use this function, add the declaration at the top of your code, and then use it.
To define a user fitting function, please refer to this page, and this tutorial shows how to define a fitting function using GNU Scientific Library.
Penn |
|
|