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
 normalize angles
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Giammy85

United Kingdom
4 Posts

Posted - 03/03/2011 :  2:16:41 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I have a column with angles in deg that I have to normalize to 0->360deg.
If in "set column values" I use rmod[col(x),360] then I have angles that span -360 +360!
Basically, something like -380 must be turned to 340; how can you do that in Origin?
Thanks

Origin Ver. and Service Release (Select Help-->About Origin): v8.0
Operating System: Windows7

larry_lan

China
Posts

Posted - 03/04/2011 :  02:44:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You need condition statement. If you are using the Set Column Value dialog, try this formula (suppose col(a) is source data):

mod(col(a),360)>0?mod(col(a),360):(360+mod(col(a),360))

Thanks
Larry

Edited by - larry_lan on 03/04/2011 9:21:33 PM
Go to Top of Page

Giammy85

United Kingdom
4 Posts

Posted - 03/04/2011 :  07:00:18 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
That works fine, thanks Larry
Go to Top of Page

Giammy85

United Kingdom
4 Posts

Posted - 03/04/2011 :  08:15:23 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Now I have angles for which is more convenient plotting them in the region -180->180deg.

Basically, if I have an angle<-180 then I should add 360 to it, if I have an angle>180 then I should subtract 360 to it.

it should be something like that
-180<rmod(col(a),360)<180?rmod(col(a),360): .....
else if
-180>rmod(col(a),360) => ( 360+rmod(col(a),360))
180<rmod(col(a),360) => (-360+rmod(col(a),360))

how can I do that?
Go to Top of Page

larry_lan

China
Posts

Posted - 03/05/2011 :  02:03:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Supposed now col(b) was normalized to [0, 360], transform col(b) into col(c) as:

col(b)<=180?col(b):col(b)-360

Larry
Go to Top of Page

Giammy85

United Kingdom
4 Posts

Posted - 03/06/2011 :  2:26:28 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
oh yes, thanks Larry
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