T O P I C R E V I E W |
wzm39 |
Posted - 07/04/2019 : 10:59:37 AM Thanks for help! I'm trying to do a nonlinear fitting of complex number. I have two questions regarding to this.
First, I tried two ways to separate the real part and imaginary part of my complex number. I have column A as my omega, and then column B=1/(1+1i*A/3e5). When I do function imaginary(B) for column C, it goes to 0. I already set my column property to numeric--complex. However, it works when I set column C as imaginary(1/(1+1i*A/3e5)). I'm wondering why the first way does not work?
Second, I tried to creat a nonliear curve fitting functiom with the user defined function. I refer to this https://my.originlab.com/forum/topic.asp?TOPIC_ID=7296 I create a new function -- explicit -- Origin C independent x, dependent y1 y2, parameter tau in the function body, I have: complex cc=1/(1+1i*x*tau) y1=cc.m_re y2=cc.m_im when I do the quick check, it shows compile error.
I have no idea where it goes wrong. Since I'm doing unsymmetric peak fitting and debye equation is actully not sufficient, I do need help regarding to those two problems
Thanks and I do appreciate any help!
|
7 L A T E S T R E P L I E S (Newest First) |
YimingChen |
Posted - 07/23/2019 : 1:51:44 PM 1) You can go to menu Gadgets:Quick Fit:Open Dialog... In the dialog, set Fit Mode to Nonlinear Curve Fit and select <more>... in dropdown of Function, you will be able to use any nonlinear function for the gadget.
2) Please refer to this web page for fitting with Differential Equation, it needs some coding: https://www.originlab.com/doc/Tutorials/Fitting-Ordinary-Differential-Equation
Thanks, James |
wzm39 |
Posted - 07/23/2019 : 1:15:20 PM Hi James, thank you so much! It works now! Could you also help with those two problems?
1) I'm not sure whether we can do the fit with only several data points not the whole of them. I have this problem when I do the fitting with debye equation. When I do the fit it seems that the fitting process goes for all the data points. This is not what I want as the debye peak is too ideal. I tried to fit a range of the data using gadgets, I think for the linear fitting this gives a reasonable value. But I did not know how to get this work with NLfitting!
2) for the complex function we have above, we fit y1, y2 from y. Is that possible for me to fit derivative y like d_y/d_lnw to the experimental data with only the expression based on y? I know I could just use the equation of d_y/d_lnw, but I'm just curious to see if this also works.
what I mean is , if y=Ax^n is the function. A, n is the fitting parameter. I know dy/dx=A*n*x^(n-1). I have my experimental data which corresponds to dy/dx. Is that possible for me to define y=Ax^n, y1=d_y/d_dx so that I can fit y1 for my experimental data without refering to the expression of d_y/d_x? It seems to me that this is very much similar to what we previously discussed to separate the real and imaginary part of y.
Thank you very much for your time! I can open a new question if that is more convenient to you and to others!
Thanks and have a nice new week!
quote: Originally posted by YimingChen
Hi,
In the NLFit dialog window shown in your attached pdf, you can click the "+" button aside Input Data label, see if you can specify y1 and y2 range there. The details can also be found in the tutorial page: https://www.originlab.com/doc/Tutorials/Fitting-ComplexFunc
Thanks, James
|
YimingChen |
Posted - 07/22/2019 : 10:35:10 AM Hi,
In the NLFit dialog window shown in your attached pdf, you can click the "+" button aside Input Data label, see if you can specify y1 and y2 range there. The details can also be found in the tutorial page: https://www.originlab.com/doc/Tutorials/Fitting-ComplexFunc
Thanks, James |
wzm39 |
Posted - 07/20/2019 : 12:46:22 PM https://my.originlab.com/ftp/forum_and_kbase/Images/originlab_debye.pdf
I attached the function I saved in my function organizer and the NLfit dialog when I did the fit. I did not see the two dependent variables I could select to fit the y1 and y2 simultaneously.
Thanks again for helping!
|
wzm39 |
Posted - 07/20/2019 : 12:41:39 PM Hi James, Thank you very much for your reply! I think I fix the first issue.
However, with the second one, I still could not figure out how to do that as suggested.I think the problem I have is that I need to fit y1 and y2 simultaneously. But when I opened the NLfit dialog, there is no that option as shown in the tuturial that allow me to choose the data range for y1 and y2 (I attached the screen shot in the reply below) I'm not sure whether this is because 1) I input the wrong function and/or 2) I did some thing wrong with NLfit
Thanks again for your reply and I do look forward to further suggestions!
quote: Originally posted by YimingChen
Hi,
For question 1: it should work after set col(B) Data Type to complex(16).

For question 2: You may have missed semicolon in the end of the line, try
complex cc=1/(1+1i*x*tau);
y1=cc.m_re;
y2=cc.m_im;
Also to fit y1, y2, please refer to this tutorial: https://www.originlab.com/doc/Tutorials/Fitting-ComplexFunc
Thanks, James
|
YimingChen |
Posted - 07/08/2019 : 3:17:43 PM Hi,
For question 1: it should work after set col(B) Data Type to complex(16).

For question 2: You may have missed semicolon in the end of the line, try
complex cc=1/(1+1i*x*tau);
y1=cc.m_re;
y2=cc.m_im;
Also to fit y1, y2, please refer to this tutorial: https://www.originlab.com/doc/Tutorials/Fitting-ComplexFunc
Thanks, James |
wzm39 |
Posted - 07/04/2019 : 11:35:45 AM in addition, If I specified y1 and y2 in my user-defined function. How I can fit my data sets with it? I need both the real and imaginary part to be fitted! Is that possible for me to do the nonlinear fitting with multiple dependents?
Thanks!!! |
|
|