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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Mode value normalization

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
niccnacc Posted - 01/30/2013 : 1:34:17 PM
Origin Ver. and Service Release (Select Help-->About Origin): 9
Operating System: win7

Hi!
I've got a column with speed(Y) and another one with time(X).
I need to find the Mode value of the Y column, or normalize both by the Mode of Y!
I allready found the X-Func normalize, but the problem (as with the interface version of it) is, that I can't use it for another column!
normalize iy:=(1,2) method:=Divided by Mode {9}  oy:=<new>;

If possible it would be great if I could actually see the Mode aswell (get it into a variable to type it out).

So for short:
Take col x & y and divide them by the Mode of y and get them into two new columns.

Thanks for any advice on this.
4   L A T E S T    R E P L I E S    (Newest First)
niccnacc Posted - 02/01/2013 : 12:21:48 PM
Thank you. But it is allready too late. At least there is a way.
Next time though I probably settle by matlab or somehting more deterministic. I see origin as a great graphing tool, but you defintly see, that the numerics and other features just got added by time - and in my opinion not well thought through.

I'm not the expert, but to tell the least it's not userfriendly for beginners.
greg Posted - 02/01/2013 : 10:27:53 AM
As you discovered, the normalize function cannot calculate a statistic (here Mode) on one range, but apply the normalization to two ranges.

Unlike other statistics, there can be more than one Mode for any distribution so none of the general descriptive statistics handle mode completely and typically return just one Mode (or none if there is none).

You can use the discfreqs function ( see Statistics : Descriptive Statistics : Discrete Frequency ) to get counts for all unique values in a distribution sorted by count (descending). The value(s) at the top will be the Mode(s).

discfreqs irng:=2 rd:=[<input>]<input>!<new>;

You can use the first mode reported by that to normalize both Time and Speed:

Mode = wcol(wks.ncols-1)[1];
col(1) /= Mode;
col(2) /= Mode;
niccnacc Posted - 01/31/2013 : 1:03:36 PM
For the sake of completeness of my monologue:

// Filename:    Custom.ogs
// Purpose:     The Custom Routine button on the standard toolbar will use this code, by calling
//		the [Main] section 
// Modifications:


////////////////////////////////////////////////////////////////////////////////
// Main Code 
////////////////////////////////////////////////////////////////////////////////
[Main]	
colmove r:= Col(1) operation:= right;
;
col(B)[L]$ = "Time";
col(B)[U]$ = "ms";
col(A)[L]$ = "Velocity";
col(A)[U]$ = "m/s";


wks.addcol(Normtime);
wks.col(Normtime).type = 4;
Col(Normtime)[U]$ = $(1);
Col(Normtime)[L]$ = "Norm. Time";
Col(Normtime)[C]$ = "Normalized with * U / d";

wks.addcol(Velocity);
wks.col(Velocity).type = 1;
Col(Velocity)[U]$ = $(1);
Col(Velocity)[L]$ = Normtime;

wcolwidth irng:= col(Normtime) width:= 10;
wcolwidth irng:= col(Velocity) width:= 10;


range xx = col(Normtime);
range yy = col(Velocity);

normalize iy:=(1,2) method:=9 oy:=(xx,yy);

double modalwert = col(2)[1] / col(Velocity)[1];

//type -b modalwert: $(modalwert);

col(Normtime)= col(Normtime)/0.0303*modalwert/1000 *(-1);

if(wks.col1.type == 1){
	wks.col1.comment$ = Modalwert: $(modalwert);}
else if (wks.col2.type == 1){
	wks.col2.comment$ = Modalwert: $(modalwert);}
niccnacc Posted - 01/31/2013 : 09:14:42 AM
I've used a very ugly workaround, but get a quite strange (hopefully easy to solve) problem:

with:



// Filename:    Custom.ogs
// Purpose:     The Custom Routine button on the standard toolbar will use this code, by calling
//		the [Main] section 
// Modifications:


////////////////////////////////////////////////////////////////////////////////
// Main Code 
////////////////////////////////////////////////////////////////////////////////
[Main]
wks.addcol(Times);
wks.col(Times).type = 4;

wks.addcol(Velocity);
wks.col(Velocity).type = 1;

range xx = col(Times);
range yy = col(Velocity);

normalize iy:=(1,2) method:=9 oy:=(xx,yy);


double modalwert = col(2)[1] / col(Velocity)[1];


// Loop on time rows
for(ii = 1, ii <= wks.col(Times).nRows, ii++)
	col(Times)[$(ii)]= col(Times)[$(ii)]*0.0303)/(modalwert*1000);


//type -b Modus: $(modalwert);
if(wks.col1.type == 1)
	wks.col1.comment$ = Modalwert: $(modalwert);
else if (wks.col2.type == 1)
	wks.col2.comment$ = Modalwert: $(modalwert);
wks.col(Times).comment$ = Col $(1)  * $(0.0303) durch mode*$(1000);


I nearly have everything covered, but the loop doesn't work!
Same with for(...)

I've tested it, even:
loop(ii, selr1,selr2)
	col(selc1)[ii] = col(selc1)[ii]+50;

doesn't change any values in the selected column.
Can any1 help me on this?

It's very urgent and important to me. Especially, because I've wasted much time on this now.

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000