LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cumulative probability function

Hi!

 

The condition is I have a packet of datas (sample pictures shown in the attachment). Say the desire class size is 100 with min value of 0 to max value of 0.008. Total sampling is 150 (instead of using 1500000). 

 

Graph1

From there I would want to construct a histogram where, in my case it would be amplitude of 150 at value 0 to 0.0048 and amplitude of 0 at 0.0048 onwards. Class size = 100 means I will divide the graph to 100 levels. 

 

Graph 2

Definitely at value 0 of the histogram would be approx. amplitude of 150 and when it at value 0.0045, amplitude would be approx. 2 and of cause it will be amplitude of 0 for value of 0.0046 onwards too 0.008.

 

 

Basically I needed all the information at the bottom area of the signal. It is not the normal type of histogram as histogram obtain data in vertical form but in my case i needed the data read horizontally. Hope I am not confusing you guys who are trying to help me out. 

 

Thank you very much in advance 😃

 

Warmest regards, 

Bernard

0 Kudos
Message 1 of 6
(4,716 Views)

Hi Bernard,

 

I don't really understand the part about your class size versus the total number of samples.

 

Nevertheless, here's some information regarding histograms and horizontal bar graphs that I hope can help.

 

LabVIEW has this Histogram function that can help you get the normal vertical histograms. You can refer to the example finder and look for the histogram examples.

 

After that, to convert the normal vertical histogram to a horizontal one, you can make use of the XY-graph. Transpose the data in the vertical histogram and fit it into the XY graph. Use the Bar Plots for your plot setting. Example as follows:

Sample.JPG

 

Regards,
Boon Chen

0 Kudos
Message 2 of 6
(4,689 Views)

Hi Boon Chen,

 

Thanks for spending time to answer my question. What I needed is not to switch the histogram axis from x to y and vice versa.

 

Allow me to further explain what I needed actually. I have attached an example packet signals which I am going to build a cumulative histogram out of it. As realize from the graph, the total number of samples is 50 (2779 – 2729 = 50; x-axis). Assume I needed 10 classes which is divided evenly from 0 to 1 (0.1 each classes; y-axis). I have plotted out the histogram I desire using Excel. As you can see, I am actually plotting the value which is under the graph (the area under the graph). Can this be done?

 

Looking forward to your reply. Many thanks in advance 😃


0 Kudos
Message 3 of 6
(4,678 Views)

Hi Wengyew,

 

There definitely is a way to do what you want, just which is the easiest way.

 

How are you currently getting the tabulated values? Manually?

 

LabVIEW has some cumulative probability functions that you can find under the Mathematics >> Probability & Statistics >> Probability function palette so you can take a look there to see if there's any function you can use.

 

We also have an example for those probability functions.

 

If there's no ready function you can use, then we will have to do it step-by-step in a loop.

For every class you need, compare the signal values to the class value (eg. 0.1, 0.2, 0.3) to see if they are greater. From the array of boolean results, count the number of True values and that will correspond to your count. After that you can put the results into an XY-graph to achieve your histogram.

 

Regards,

Boon Chen

0 Kudos
Message 4 of 6
(4,652 Views)

Dear Boon Chen,

 

I have tried many times with your suggestion method and i am still unable to get it working.

 

I've tried using the cumulative probability function to solve it by creating a for loop function in my while loop, something similar to the NI example yet I don't know where to go from there. The tabulated values used are created using write to measurement file (in excel format) by Ni Daq card from my hardware reading. 

 

I do hope that you can write me a simple coding to assist me further. Time is really running out for me!

 

Again, many many thanks in advance and looking forward to your prompt replies.

 

Best regards,

Bernard 

0 Kudos
Message 5 of 6
(4,567 Views)

Hi Bernard,

 

If you already have the tabulated values readily available from a file, all you have to do is to read the data from file and plot it on a XY-graph. Refer to example 1 in the block diagram.

 

My suggestion on the probability functions is if you don't already have the tabulated data. I am not familiar with those probability functions, so I cannot help on the underlying theory. But in layman terms from what I understood from your attached picture, you should be able to get the desired numbers from a raw signal using the histogram function and post-processing the data in the histogram. Refer to example 2 in the block diagram.

 

Block Diagram.JPG

 

The front panel display is as follows,

 

Front Panel.JPG

 

Regards,

Boon Chen

0 Kudos
Message 6 of 6
(4,549 Views)