LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate random numbers with a known distributi​on f(X)=(8X^2 + 1)*Exp( -X^2 ).

Solved!
Go to solution

I am glad it worked for you. 🙂

 

A few bits of advice to improve your code:

 

  • For a simple data generation such as this, I would not use Mathscript. Most likely is it slower and uses more memory, but it also makes loading the VI much slower. I would use plain g as in my example.
  • You are introducing too many orders of freedom, making the code hard to maintain in the future. by doing the forward scaling of x and the backward scaling later with separate diagram constants (5, 10), you are setting yourself up for future problems. Imagine you want to modify the code a year from now with a different function and different x range. You would need to make the same changes in two different locations, and, if you miss one spot, everything falls apart. Again look at my example how the scaling is done in one single place.

 

Message 11 of 12
(401 Views)

Many thanks to  for your good advices!

You are a real expert on Labview!

0 Kudos
Message 12 of 12
(383 Views)