T O P I C R E V I E W |
minfaer |
Posted - 11/25/2014 : 2:10:29 PM Hi Everybody,
I recently needed to fit some data with a rectangular peak function. As I couldn't find any predefined such, I went on and defined one myself using OriginC. The Function uses 4 parameters, which are: - y0, an offset
- A, the Amplitude of the Rectangle
- b, the width
- x1, the center
Now, when i use the NLFit-Tool, b is not altered in any way, but keeps the initial value. Even setting all the other parameters fixed does not change this, so it is not an Overparameterisation-Problem. Do You have any idea on how to fix this or another way to fit a rectangle-peak?
My Function-definition looks like this (tabbed out a little so you dont have to think about encapsuled ifs):
if (x < (x1-(b/2)))
y=y0;
else
{
if (x==(x1-(b/2)))
y=y0+A/2;
else
{
if (x < (x1+(b/2)))
y=y0+A;
else
{
if (x == (x1+(b/2)))
y=y0+A/2;
else
{
y=y0;
}
}
}
}
Origin Version: ro 9.1.0G Sr3 Operating System: Win8.1 64bit |
2 L A T E S T R E P L I E S (Newest First) |
minfaer |
Posted - 11/27/2014 : 06:10:34 AM Thank You very much for your reply, Jason, the LabTalk script worked much better for sure. But I have 2 remaining concerns:
1. The fit does not give values for the uncertainty or the dependency of S and E. While I am not particularly interested in those, I would like to know whether this might be a hint to their values being unreliable.
2. They (S and E) also are highly dependent on the initial values. In the below example, E was Set to 20.2, with 20.0, the fit converges differently, the line is still visible in the graph. This indicates that the initial values already fix, what data lies inside the box, and what is outside, which is one information i hoped to get from the fit.
I need the rectangular fit because this aims at evaluating how well i succeeded in creating a rectangular Profile in an excitation of a certain width.
Edit: My Interpretation of concern 2.) is that the fit simply converges to a local minimum of chi^2, so I tried the possible values between the data and chose the one with the least chi^2, believing it to be it's global minimum. In the Example, that is the shown value near 20.2. |
jasonzhao |
Posted - 11/27/2014 : 02:10:51 AM Hello,
You can try this method, however, initial value need to be estimated first, which means that initial value should be chosen close to the real value.
Best regards, Jason Zhao OriginLab Tech |
|
|