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
 Origin Forum
 Nonlinear curve fitting with complex coefficients

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
cjs7 Posted - 07/08/2010 : 11:26:45 PM
Origin Ver. and Service Release (Select Help-->About Origin): 8.0
Operating System: Windows 7

I was wondering if it is possible to write a user defined function that can handle complex coefficients. The specific function I am trying to fit is shown in the attached PDF file. I am looking to fit 6 pole pairs (N=6) where c_p and a_p are the complex coefficients and the asterisk in the superscript represents the complex conjugate. Note that the "j" represents the imaginary number(i.e. square root of -1)

To summarize, the coefficients are eps_inf, c_p, and a_p where c_p and a_p are complex valued. The given data is eps_0, omega, and eps(omega) where eps(omega) is also complex valued.

I am not well versed in Origin C, so any code snippets would be extremely helpful. Thanks.

http://www.originlab.com/ftp/forum_and_kbase/Images/pole_residue_equation.pdf
5   L A T E S T    R E P L I E S    (Newest First)
shafei Posted - 11/24/2010 : 11:51:21 AM
Thanks Greg, problem resolved.
greg Posted - 11/24/2010 : 11:05:55 AM
Double-click on any column short name to open Column Properties.
Change Format to Numeric.
Change Data Type to Complex(16).
Click OK.

Then type in cell
-1.234+5.678i

Here is a script example
// BEGIN SCRIPT
range ra = 1; // Column 1
ra.type = 1; // Set to Numeric
ra.numerictype = 11; // Set to Complex
string str;
for(idx=1;idx<=50;idx++)
{
str$ = $(rnd()) + $(rnd())i;
ra[idx]$ = %(str$);
}
// END SCRIPT
shafei Posted - 11/18/2010 : 5:45:42 PM
I talked to a representative due to the same issue. He mentioned that LabTalk console has issues with handling complex numbers, however, setting datatype in columns to complex, can resolve the problem. So you do not need to separate Real from Imaginary part.
The problem is that, I tried couple of things, but couldn't figure out how to set column to complex.
cjs7 Posted - 07/09/2010 : 09:55:12 AM
Okay, I understand that. It is straightforward enough. My issue is with the parameters. I notice that when I go to type in my function in the pre-defined Origin C code block, it automatically sets the type of each parameter and variable to double. Is there a way to set the type to complex?
Shirley_GZ Posted - 07/09/2010 : 04:16:45 AM
Hi cjs7,

To fit with a complex function, you should separate the complex function to two functions firstly: one corresponding to its real part and the other corresponding to its imaginary part.

See the example here, http://www.originlab.com/www/helponline/origin/en/mergedProjects/Tutorial/Tutorial/Fitting_Complex_Function.html

Thanks,
Shirley

Originlab Technical Service Team

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