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
 Origin Forum
 How to perform linear fit in a specific yy range
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cavaco123

Belgium
7 Posts

Posted - 04/17/2012 :  11:04:21 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin):8.1 SR2
Operating System: Windows XP

Hi,

I have the following situation where I have per sample several sets of data where it is necessary to:
  • After importing the data, select a few columns per data set and plot them (the selected columns vary from data set to data set)
  • Perform a linear fit from a specific value of yy to another specific value of yy
  • From that fit determine the value for:
    • a/b
    • constant/b
    (a being the intercept and b the slope)
  • Plot all a/b and constant/b results in two separate graphs where the x-axis will be the name of the samples

For the time being since Ive not many samples Im doing the following:
  • I import the data and plot it using a user defined graph I created in the template library. In this graph the y axis is divided by a constant
  • In the plot setup dialogue box I only select the columns I'm interested in
  • For the linear fit, I manually select in the graph all data points between the yy interval Im interested in (Analysis - fit linear- open dialogue- input data - range)
  • From the resulting fitting table I copy all the A and B values to another table where I do the required divisions
  • In another table I group the results by sample number and plot it in a scatter plot

Since the work load is ramping up any tip to simplify this process is really welcomed.

I can send an example file as long as you indicate me a specific email address to sent it to.

Thank you in advance for your help!
Kind regards,

Cel

LionAM

Germany
11 Posts

Posted - 04/17/2012 :  12:28:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
What about using a simultanious fit?

I have Origin 8.0 (German), but I think this should be similar in Origin 8.1:
- Plot all datasets into a single graph
- Use the nonlinear fitting tool:
select polynomial -> line,
select "data selection" on the left side,
there you can select all functions and the corresponding range
I prefer doing it by directly editing the data input line, e.g.:
[Graph1]1!(1"B"[3:6],2"C"[3:6])
- Fit it

All results should be within a single worksheet.

Alex
Go to Top of Page

cavaco123

Belgium
7 Posts

Posted - 04/18/2012 :  05:07:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Alex,

Thanks for the fast reply and indications.

Regarding the given advises:
I just tried the nonlinear fitting tool. However, I'm having problems to define the fitting range.I see that it is possible to introduce constrains, but so far I've not managed to specify the fit only for values that are between the yy range of, for example, 20<y<40. I see I can restrict according to line numbers, but unfortunately that does not do the trick.
It seems to me I've to change my data so the yy values are xx, and like that i might be able to introduce some constrains...

For the rest of the stuff i need to do, i'll keep on looking in the help sections.

Thanks again for the suggestions and time to read and reply to this post!!

Best regards,
Cel
Go to Top of Page

easwar

USA
1964 Posts

Posted - 04/18/2012 :  08:35:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Cel,

In the latest version, one can restrict the fit range by specifying start and end x values, but you are correct, there is no provision to specify the fit range using start and end y values.

One option perhaps is to run some script that will mask the data outside of the desired y range, and then fit.

If you are looking to automate this to process many files, you may need some combination of analysis templates and/or scripting.

If you send some data files, and an OPJ with say the results of analysis from one file, we can take a look. Use the "Send File to Tech Support" link on top of this page, and refer to this post in your message.

Easwar
OriginLab
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 04/19/2012 :  4:13:42 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Cel,

For the Easwar's idea - masking the data outside of the desired Y range, you can also do the following handy way:

1) When your worksheet is active, choose "Worksheet: Worksheet Query" menu to open this tool.

2) Enter the condition for the outside of the Y range, for example, your Y range for column B(Y) is -0.5<= B <=0.5, then enter
B<-0.5 OR B>0.5
in the condition box, and turn ON the "Select" radio button in the Output area. Click
OK to close the tool. The outside area are selected (highlighted).

3) Right-click on the highlighted cells, and choose "Mask> Apply" fluout. It will mask the highlighted area.

Now, you can plot (or already plotted), and fit only for the unmasked data only.

Hope this helps.

--Hideo Fujii
OriginLab
Go to Top of Page

easwar

USA
1964 Posts

Posted - 04/19/2012 :  5:09:52 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Cel,

Thank you for sending your OPJ to tech support. We will look at it and e-mail you back.

Easwar
OriginLab
Go to Top of Page

cavaco123

Belgium
7 Posts

Posted - 04/20/2012 :  04:46:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by Hideo Fujii

Hi Cel,

For the Easwar's idea - masking the data outside of the desired Y range, you can also do the following handy way:

1) When your worksheet is active, choose "Worksheet: Worksheet Query" menu to open this tool.



Dear Hideo,

Thank you for your detailed post.
However, even after selecting a worksheet I don't see the option "Worksheet: Worksheet Query". As so, can it be possible that this option is only available for Origin versions higher than the 8.1? The 8.1 is what we have here at work.
If that is not the case, I'm most likely missing some step.

Thanks again.
Regards,

Cel



Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 04/20/2012 :  10:56:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Cel,

I'm sorry, "Worksheet Query" was called "Extract Worksheet Data" under Worksheet menu in version 8.1, or older. Also, your version's lacks the capability of selecting cells which satisfy the condition.

What you can do is, as Easwar wrote, to run the script like below:

///////////////////////////
Lo=-0.5; Hi=0.5;
range r1=col(B);
Loop(ii,1,wks.maxRows){if(r1[ii]<=Lo || r1[ii]>=Hi) r1<ii>=1};
///////////////////////////

You can run this script from the Script window, or if you don't want to forget, you can put this code in the "Before Formula Scripts" box in the Set Column Values tool for your Y column (The body can be empty).

--Hideo Fujii
OriginLab
Go to Top of Page

LC_

42 Posts

Posted - 04/24/2012 :  04:20:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi

I was into this issue a couple of days ago, but unfortunately the Worksheet Query does not help much when you have one graph with plots coming from different worksheets. I settled down selecting the data graphically using either the Regional Mask Tool on all plots eihter the Regional Data Selector on all plot.s The later on is preferred as the regional mask will effectively deactivate the datapoint on every graph and calculation that you might have.
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