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
 LabTalk Forum
 can't fit multiple datasets with nlfit X-function
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

buckmurdock

Sweden
Posts

Posted - 05/20/2009 :  11:35:11 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin 8 SR5, with Vista.

I'm having a lot of trouble using the "range" command with the nlbegin/nlfit/nlend X-functions.

I have a worksheet with many data columns in XYXY... format. I want to fit several of them simultaneously, with individual parameters, and specifying a row range. And I want to fit them directly from the worksheet, without having to plot them first.

It seems like it should work like this:

range aa=1[1001]:8[1200];
nlbegin aa expdecay2 tt cons;
nlfit;
nlend 1;


I expect this to fit my first 4 sets of XY data, but it seems that it only looks at the first column in my range. So this fits col 1 (X data) against itself. If I instead use "range aa = 2[1001:1200]", then it correctly fits col2 against its X data in col1. But if I use "range aa = 1[1001]:2[2000]" then it just fits col1 against itself.

So how can I fit multiple datasets using the X-function commands?

Thanks in advance.

cpyang

USA
1406 Posts

Posted - 05/20/2009 :  2:18:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
nlbegin takes an XY Range, so you need to explicitly specify X and Y columns. If your data is XYYY, then

range aa=(1,2:4)[1001:1200];

but if data is XYXYXY, then has to do

range aa=((1,2),(3,4),(5,6))[1001:1200];

There is also the notation

range aa=(?,1:end)[1001:1200];

to automatically picking up XY in worksheet but that somehow failed when row range is also specified, we will try to fix that in SR6. For now, you can use the more explicit notation to get things going.

This wiki has more explanations about using Range and XYRange in X-Functions.

http://wiki.originlab.com/~originla/wiki/index.php?title=LabTalk:Range_Notation#Range_as_X-Function_Arguments


CP
Go to Top of Page

buckmurdock

Sweden
Posts

Posted - 05/22/2009 :  04:39:07 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks, that's what I needed!

I had looked through the documentation and tried many variants of the range statement but what I needed was the nested form ((1,2),(2,3))[1:5] etc.

I never saw this way to do range notation in the documentation, so it would be good to include it in the future.

buck
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