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
 smoothing script wanted!
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Pythe

Netherlands
Posts

Posted - 10/12/2004 :  09:06:17 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I don't know anything (yet) about making or even using scripts, so I hope someone is willing to help me with the following:

I want to perform a Savitzky-Golay smoothing on all the Y-data in my worksheet (sharing one X-data column) and create a new worksheet with the same X-data column and the adapted Y-data columns. Can someone write a script, tell me how to use it and where I can alter the smoothing parameters if necessary?

Thanks a lot!

Pythe

Mike Buess

USA
3037 Posts

Posted - 10/12/2004 :  11:18:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Pythe,

This script will duplicate and smooth the active worksheet using SG method. Results will go to the duplicate wks. To execute... copy all lines to the script window, adjust polydeg and pts as desired, then select all lines and press Enter.

polydeg=3; // polynomial degree (1-9)
pts=2; // number of pts to smooth on right and left
%I=%H; // name of active wks
win -d; // duplicate
doc -e W {%R=%H}; // find name of new wks
curve.polydeg=polydeg;
curve.smoothleftpts=pts;
curve.smoothrightpts=pts;
curve.smoothpts=2*pts+1;
curve.x$=%(%I,1);
loop (i,2,wks.ncols) {
curve.data$=%(%I,i);
curve.result$=%(%R,i);
curve.SGSmooth();
};
win -a %R; // active results

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 10/12/2004 11:20:13 AM
Go to Top of Page

Pythe

Netherlands
Posts

Posted - 10/15/2004 :  05:14:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

Thanks for the code. Works perfectly!

Pythe
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