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
 Data Reduction for non-equally spaced binns
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Milkomeda

Germany
1 Posts

Posted - 01/05/2018 :  08:04:35 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release: Origin 2018
Operating System: Windows 7

Goal: getting the Mean of the user-defined bin-boundaries applied X-values and getting the Means of the Y-values corresponding to bin-boundaries imposed on X-values

Already tried method: Reduce by Group (given in Analysis --> Dada Manipulation) has been tried. This method is only relevant when intervals or the groups are equally spaced in X-values. However, my goal is to get the Mean of unequally spaced bin-boundaries defined by the user.
For example, From Col(A), the Mean of: row 1 to row 5, from row 5 to row 10, from row 10 to row 20, from row 20 to row 40 and so on. And the Mean of the Y-values corresponding to bin-boundaries imposed on X-values.

Method of 2D Binning or Logarithmic Binning is also not helping.

Warning: I am not good at programming

Thanks in Advance
MilkoMeda

Edited by - Milkomeda on 01/05/2018 08:05:38 AM

Hideo Fujii

USA
1582 Posts

Posted - 01/05/2018 :  1:34:05 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi MilkoMeda,

You can run the following script, assuming your data is stored in col(A) in Book1, and col(A) in
Book2 contains the row# 's of bin boundaries. For example, when [Book2]!col(A) has {1, 5, 10, 20},
the means of bins correspond to: 1...5, 5...10, and 10...20.

////////////////////////////////////////////////////////
range r2A=[Book2]1!col(A);  //Bin boundaries 
range r2B=[Book2]1!col(B);  //Output column
nbin=r2A.getSize();         //number of bins
for(ibin=1; ibin<nbin; ibin++) {  //Repeat times of bins
  range rv=[Book1]1!col(A)[$(r2A[ibin]):$(r2A[ibin+1])]; //Target range
  r2B[ibin]=mean(rv);   //Assign mean value
}
////////////////////////////////////////////////////////
The output would be stored in col(B) of Book2.

Hope this helps.

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 01/05/2018 1:47:31 PM
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