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
 Center of gravity of a matrix

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
couturier Posted - 02/08/2011 : 03:32:01 AM
Origin Ver. 8.5 SR1
Operating System: XP Pro SP3

Does anyone know a fast way to compute the center of gravity of a matrix with Labtalk ?

For now, I'm doing it the hard way: Sum(Xi.Zi)/Sum(Zi) and Sum(Yi.Zi)/Sum(Zi) but it is something I want to perform MANY times and looping through rows and cols is way too slow.

Thanks
2   L A T E S T    R E P L I E S    (Newest First)
couturier Posted - 02/18/2011 : 5:32:43 PM
quote:
You can use X-Function mstats

Using Xf is a no-go (way too slow, because of overhead).

Anyway, if anyone is interested, I've found that the sum function works with matrix, result being stored in sum.total
Sam Fang Posted - 02/09/2011 : 04:54:33 AM
You can use X-Function mstats to calculate the sum of a matrix.

To calculate the CG of a matrix, you can create two additional matrices for Xi*Zi and Yi*Zi first using Set Matrix Values.


Sam
OriginLab Technical Services

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