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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Fitting Rectangular Peak
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

minfaer

Germany
2 Posts

Posted - 11/25/2014 :  2:10:29 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Edited by - minfaer on 11/25/2014 2:13:05 PM

jasonzhao

China
262 Posts

Posted - 11/27/2014 :  02:10:51 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Edited by - jasonzhao on 11/27/2014 02:11:09 AM
Go to Top of Page

minfaer

Germany
2 Posts

Posted - 11/27/2014 :  06:10:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.

Edited by - minfaer on 11/27/2014 10:26:50 AM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000