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
 Interpolating Data in Labtalk
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

HansBrouwer

Netherlands
Posts

Posted - 08/01/2005 :  10:03:33 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi everybody,

My name is Hans Brouwer. I have been working with origin for a very short time, so i am really fresh. It could be that i am boring some of you with my questions, but i would like to have some advice about Interpolating Data in Labtalk.

I have a worksheet containing say 1000 columns Y and 1 column X. I would like to interpolate all these columns. Manually it is done by selecting X and one of the Y, Plot it and then interpolate the graph using the Analysis-Interpolate/Extrapolate option.

I have tried to obtain information from the Programming Help file. Could be that i am not looking hard enough, or that it is not there.
Could anyone help me out here?

Best Regards,

Hans Brouwer

Mike Buess

USA
3037 Posts

Posted - 08/01/2005 :  11:10:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Hans,

This is probably better done in Origin C but you can also use LabTalk's Table function. Assume your data are in Data1 with first col A(X). Create a new worksheet Data2 and fill its col A(X) with the X values at which you want to interpolate. Next, delete all Y columns in Data2. Finally, run this script...

%W=Data1;
win -a Data2; // activate results wks
loop (i,2,%W!wks.ncols) {
wo -a 1; // add Y column to Data2
%(%H,i)=Table(%(%W,1), %(%W,2), %(%H,1));
};

I'm not sure what type of interpolation (probably linear) is used by the Table function but it has produced reasonable results when I've used it.

...A more detailed description of the Table function is available in the Knowledge Base.

http://www.originlab.com/www/support/resultstech.aspx?ID=680&language=English

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 08/01/2005 11:15:16 AM

Edited by - Mike Buess on 08/01/2005 11:27:28 AM
Go to Top of Page

HansBrouwer

Netherlands
Posts

Posted - 08/01/2005 :  4:39:37 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hey Mike,

Thank you for helping me out!! I am not at work now, but i will use your script tomorrow morning.

Best regards,

Hans
Go to Top of Page

HansBrouwer

Netherlands
Posts

Posted - 10/25/2005 :  10:59:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:

Hi Hans,

This is probably better done in Origin C but you can also use LabTalk's Table function. Assume your data are in Data1 with first col A(X). Create a new worksheet Data2 and fill its col A(X) with the X values at which you want to interpolate. Next, delete all Y columns in Data2. Finally, run this script...

%W=Data1;
win -a Data2; // activate results wks
loop (i,2,%W!wks.ncols) {
wo -a 1; // add Y column to Data2
%(%H,i)=Table(%(%W,1), %(%W,2), %(%H,1));
};

I'm not sure what type of interpolation (probably linear) is used by the Table function but it has produced reasonable results when I've used it.

...A more detailed description of the Table function is available in the Knowledge Base.

http://www.originlab.com/www/support/resultstech.aspx?ID=680&language=English

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 08/01/2005 11:15:16 AM

Edited by - Mike Buess on 08/01/2005 11:27:28 AM

Go to Top of Page

HansBrouwer

Netherlands
Posts

Posted - 10/25/2005 :  11:03:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

It has been a while since i posted this question. Now i finally had to use your program. After running this program, the Data2 worksheet contains the same number of Y columns as Data1, but all columns are filled with the same numbers.

Could you help me out?

Best Regards,

Hans Brouwer
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 10/25/2005 :  11:22:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Hans,

Try replacing %(%W,2) with %(%W,i) in the Table command.

Mike Buess
Origin WebRing Member
Go to Top of Page

HansBrouwer

Netherlands
Posts

Posted - 10/26/2005 :  03:33:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hey Mike,

Thanks Alot!! My spectra look great.
Best wishes,

Hans
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