BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code


craigc wrote:

You have just solved a problem I have been having with reading phase difference from a Network analyser.  I knew there must be a way of getting the phase's back to (-pi, pi). 


Sorry, actually my method only gets you to two quadrants, i.e. [0..pi] for cosine and [-Pi/2..Pi/2] for sine, of course. In order to reconstruct the data for all four quadrants you need more information.

 

One possibility would be to take the sine and cosine and feed the two outpus to the "Inverse tangent (2 inputs)" (see image)

 

 

Of course a simpler solution would be to divide by 2Pi and keep the remainder for an output range of [0..2Pi]. No trigonometry needed. 🙂

You can easily tweak for [-Pi..Pi]. (see image)

 

 

 

Message Edited by altenbach on 11-24-2008 08:57 AM
Download All
Message 371 of 2,635
(12,245 Views)

Why a seperate sine and cosine?

 

 

Ton

Message Edited by TonP on 11-24-2008 08:51 PM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 372 of 2,635
(12,227 Views)

Oh ho. Did Altenbach get caught in a minor Rube Goldberg?

 

     Rob

0 Kudos
Message 373 of 2,635
(12,219 Views)

TonP wrote:

Why a seperate sine and cosine?


Good catch. In this case I had the sin and cos already on the diagram from some earlier editing, so it was easier to recycle them. 🙂

Message 374 of 2,635
(12,206 Views)

Plus that way you know the Sine and Cosine functions can run in Parallel, possible improving performance on multi-core processors.

 

Shane. 

Message 375 of 2,635
(12,154 Views)

Intaris wrote:

Plus that way you know the Sine and Cosine functions can run in Parallel, possible improving performance on multi-core processors.

 

Shane. 


 

Now a benchmark test to prove which method is faster and answer if it will really run in two cores at the same time would be an interesting way to show that here are no chinks (sp?) in our Knight's armour.

 

But....

 

So far I have learned that the inverse operations when constructed using mth operations does serve a purpose (In not equal to out).

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 376 of 2,635
(12,201 Views)

Intaris wrote:

Plus that way you know the Sine and Cosine functions can run in Parallel, possible improving performance on multi-core processors.


I would not make conclusions without benchmarks. I can think of at least two scenarios where the "combo" primitive would be preferable.

 

  • Sin and cos are strongly related (e.g. sin²(x)+ cos²(x) = 1), so calculating one and derive the other could be cheaper than calculating both. I really don't know how many cpu cycles each would take.
  • It is conceivable that the combo version could be written so it internally could use multiple cores. I wonder if 8.6 does that?

 

I'll do some bechmarks to quantify things. 🙂

Message 377 of 2,635
(12,179 Views)

 

Random sightings.... 

 

(found here)

Message Edited by altenbach on 11-25-2008 01:23 PM
Message 378 of 2,635
(12,153 Views)

altenbach wrote:

 

Random sightings.... 

 

But you do have to admit that the top down processing of property nodes means that the value is written before it is read.

 

Okay, there are definitely better ways of doing these types of things which I won't enumerate.

 

     Rob

Message Edited by Robert Cole on 11-25-2008 02:29 PM
Message Edited by Robert Cole on 11-25-2008 02:30 PM
Message 379 of 2,635
(12,148 Views)

Robert Cole wrote:

But you do have to admit that the top down processing of property nodes means that the value is written before it is read.


Yes, you can even expand on the ideas and calculate 2x+1 as follows. 😄

 

 

 

Message Edited by altenbach on 11-25-2008 01:46 PM
Message 380 of 2,635
(12,139 Views)