LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Rational Fraction Approximation in Labview

Solved!
Go to solution

Hi, 

 

I am trying to do the equivalent of the following matlab function in labview:

[N, D] = rat(X,tol)

I have been using the mathscript but it does not recognize my equation. Is there a better way to do this?

 

 

0 Kudos
Message 1 of 4
(3,449 Views)
Solution
Accepted by topic author A2saSandel

Gonna need to take a ride in the wayback machine all the back to 2004.  I first encountered the need for a similar function when generating a repetitive sine wave.  It helped me determine the right # of cycles to put into a repeating buffer so that the correct sinusoid frequency could be generated despite having only discrete output sample rates available.

 

The whole thread is here.  The good stuff is found at the end in this post, where I attached 2 LabVIEW-coded methods for calculating a rational approximation.  You'll probably need the context of the rest of the thread to decipher the use of terms and names of parameters though.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 2 of 4
(3,420 Views)

MathScript should support that syntax. You can check the online help of 'rat' in the following link.

http://zone.ni.com/reference/en-XX/help/373123C-01/lvtextmath/msfunc_rat/

 

Message 3 of 4
(3,351 Views)

I did a search for Continued Fraction Approximation, and came across this interesting paper.  It should be fairly simple to program this algorithm in LabVIEW directly (no need for MathScript).

 

Bob Schor

0 Kudos
Message 4 of 4
(3,335 Views)