05-28-2013 12:32 PM
Hello.
I must create a program that gives a gaussian distrubution in graph form. I stack when I needed to get 100 numbers from the random number creator. (numeric pallette).However, even if, I can get these set of numbers, I am doubtful about the graph. What form should the graph be ? Is that X vs Mean ?
In a short saying I need to create a Gaussian Distribution with the formula written in the program. You can check out the attachment.
Solved! Go to Solution.
05-28-2013 01:02 PM
Why not use the Gaussian White Noise.vi from the Signal Processing palette? Follow that with the Histogram.vi and you have the data and the display.
Your VI only generates on point at a time so it is hard to get a distribution.
Lynn
05-28-2013 01:11 PM - edited 05-28-2013 01:12 PM
Your VI makes no sense. All you get is a single number, which, together with the value 100, you append to a file. The appended array never has more than two elements.
Please explan what you are trying to do in plain english. Your VI does not tell us!
05-28-2013 02:13 PM
Seriously, it looks like you were given the assignment, "Do something with a random number and this formula," then you opened LabVIEW and proceeded to put anything you could find that looked like it would deal with randomness and statistics into a block diagram. As altenbach said, what you have does between very little and nothing, does it a gazillion times, and does not do anything like what you tried to explain to us. Putting any kind of graph at the output of your code will not help here.
I would suggest that you:
1. Move away from the computer. Far away.
2. Figure out what a Gaussian distribution is, what random numbers have to do with it, and what the x and y data in the usual graph of it actually represent. (Hint: y is NOT 100 all across the graph here.)
3. With pencil and paper, write down exactly what you want for your output(s) and what input(s) you can supply to get this output in English, in as much detail as possible.
4. With a new sheet of paper, write pseudocode (meaning just what you think the computer needs to calculate to produce what you need from step 3, forget syntax, use English again) to produce your number(s).
5. Now, go to the computer and write LabVIEW code for your new pseudocode, checking it out (i.e., make indicators) after each and every little action, because if you write like you did in your attachment (the whole thing with one output at the end), you will have absolutely no idea where you went wrong. You can delete the indicators when you know that the section you just completed is okay.
Cameron
05-30-2013 01:45 PM
Now, considering your recommendations and critise I renewed my VI. It was my teacher's wrong programming. But somehow, he want me to create this distribution via formula node. However, he said that I need to order the numbers generated from "random number". So that the graph can give me a distribution shaped like Gaussian. He made me confused about this. On the other hand he like me to handle it on my own. How can I get this distribution via formula node. I think I needed to collect all the data before they enter formula node and then waveform graph.
05-30-2013 02:02 PM - edited 05-30-2013 02:05 PM
Well, as we already mentioned, the dice will give you an even distibution from 0..1, not a gaussian.
See how far you get!
05-31-2013 12:03 PM
I'm guessing that what you want to end up with is a plot of a "Gaussian Distribution". Suppose I gave you 1000 numbers, and said "These are random numbers from a Gaussian Distribution with mean 17 and standard deviation 5". How would you plot it? You "know" the plot should have a peak near 17, and should taper off as you go 5-10 away from 17, but how do you get this plot from the 1000 (or 1,000,000) random numbers? [Hint: histogram]
As for generating random numbers that follow a Gaussian Distribution, there are many algorithms that can do this, either exactly or approximately. One that I really like comes from the Law of Large Numbers -- the mean and standard deviation of any distribution approaches a Gaussian Distribution as the sample size increases. You can use this to make a pretty good, pretty fast, and pretty easy to understand Gaussian Distribution from the Uniform Random Number generator that LabVIEW provides.
Do the exercise -- you'll learn more than if we do it for you!
BS
06-08-2013 02:57 PM
Where I end up is a smooth curve by rearranging the inputs to the formula node. I am not sure it is representing a distribution. But it is likely a Gaussian Curve.
06-10-2013 01:17 AM - edited 06-10-2013 01:38 AM
Well, you are simply creating a theoretical gaussian curve from a ramp pattern. Where are the random numbers from the original problem? Are you sure this is the solution your teacher wants?
I think it is overkill to use an expression node instead of a "+1" primitive. The entire left side of your diagram could be replaced by a "ramp pattern" function. Also the formula node seems a bit out of place, but apparently this is required for the solution. Also, if you are autoindexing on the second flor loop, you should not wire N.
Here's a code alternative that implements the identical (potentially questionable) functionality of your code with less effort and duplication of operations (for example you take the square of the x values twice, once in the middle and then again inside the formula node. Once is enough!)