topic pythagoras calculation in LabVIEW
https://forums.ni.com/t5/LabVIEW/pythagoras-calculation/m-p/1073690#M475757
I have a .vi I am trying to write in Labview for a project that really has me stuck. Basically what I want to be able <BR />to do is calculate distance using pythagoras, given a user selected number of dimensions (up to 20). That means rather<BR />than traditionally just calculating pythagoras using x and y, I now have x, y, z, .... etc. <BR /><BR />Currently I am at the stage where I can send an array of integers, where each represents which dimension to use<BR />in calculation. eg 1 is x, 2 is y, 3 is z ... etc. <BR /><BR />What I have done is a .vi for just x and y, which I have attatched but as for expanding this for z, alpha, beta, <BR />gamma, delta etc I draw a blank. Any clues?Wed, 17 Feb 2010 10:47:44 GMTeword2010-02-17T10:47:44Zpythagoras calculation
https://forums.ni.com/t5/LabVIEW/pythagoras-calculation/m-p/1073690#M475757
I have a .vi I am trying to write in Labview for a project that really has me stuck. Basically what I want to be able <BR />to do is calculate distance using pythagoras, given a user selected number of dimensions (up to 20). That means rather<BR />than traditionally just calculating pythagoras using x and y, I now have x, y, z, .... etc. <BR /><BR />Currently I am at the stage where I can send an array of integers, where each represents which dimension to use<BR />in calculation. eg 1 is x, 2 is y, 3 is z ... etc. <BR /><BR />What I have done is a .vi for just x and y, which I have attatched but as for expanding this for z, alpha, beta, <BR />gamma, delta etc I draw a blank. Any clues?Wed, 17 Feb 2010 10:47:44 GMThttps://forums.ni.com/t5/LabVIEW/pythagoras-calculation/m-p/1073690#M475757eword2010-02-17T10:47:44ZRe: pythagoras calculation
https://forums.ni.com/t5/LabVIEW/pythagoras-calculation/m-p/1073778#M475804
<P>LabVIEW will do primitive operations on arrays. For example, if you connect two one-dimensional arrays into the add primitive, it will return an array that contains and element by element addition of the inputs. This makes your problem fairly easy. Instead of indexing individual points, index the entire location vectors of the two points you want to know the distance between. Subtract one from the other to get the differences. Square the resultant vector. Use the Array Sum to sum it, then take the square root. This approach will scale with however many dimensions you want.</P><P> </P><P>Good luck! </P>Wed, 17 Feb 2010 13:25:35 GMThttps://forums.ni.com/t5/LabVIEW/pythagoras-calculation/m-p/1073778#M475804DFGray2010-02-17T13:25:35ZRe: pythagoras calculation
https://forums.ni.com/t5/LabVIEW/pythagoras-calculation/m-p/1073789#M475809
Thanks. Being able to perform operations on the entire array fixed my problem.Wed, 17 Feb 2010 13:47:56 GMThttps://forums.ni.com/t5/LabVIEW/pythagoras-calculation/m-p/1073789#M475809eword2010-02-17T13:47:56Z