07-21-2005 02:59 PM
07-22-2005 06:33 AM
X must contain at least one sample. If X is empty, the histogram is undefined, and the VI sets Histogram: h(x) and X Values to empty arrays and returns an error. | |
intervals must be greater than zero. If intervals is less than or equal to zero, the histogram is undefined, and the VI sets Histogram: h(X) and X Values to empty arrays and returns an error. The default is 1. | |
Histogram: h(x) is the discrete histogram of the input sequence X. | |
X Values is the center values of the intervals (bins) of the histogram. | |
error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster. |
So if your data are in input array [X], the histogram.vi first determines the min and max of X.Then it divides the range min...max into a number (=intervals) of equally sized bins and looks how many elements of X fall in each bin. The bin midpoints are returned in the output array [X values] (whose length equals 'intervals') and the counts in each bin are returned in array [h(x)] which IS the histogram. You best plot [h(x)] as a function of [X values] in an XY-Graph indicator.
I do not completely understand the first part of your question. To me it seems you are generating (=simulating? or =measuring?) two sequences of digital data 0 or 1. They are contained in two arrays and the index of the arrays can be interpreted as time. If this is correct, you can just connect the two arrays by a logical AND function and get a third array which tells you when both input array simultaneously had a '1' (what you call a 'peak') .
If you feed that array into the histogram function, it will tell you the frequncy of 0's and 1's in the third array, but maybe that is not what you really want?
Please give a bit more details if I did not understand correctly what you want to achieve. You could also post examples of the input arrays. (If you post a VI: I have LV version 7.0 only.)
-Franz
07-22-2005 08:25 AM
07-22-2005 09:12 AM
Hi Franz, thanks for answering my question about the histogram parameters.
For my program, I am writing a test program which will be used with real signals in real-time. I have attached the begininning of my program. You can see there are four graphs- 2 XY plots, and 2 charts I believe, You will see that once the program runs , peaks are generated and the location (time) of the peak is recorded in an indicator for my 2 signals.
I would like to start comparing signal 1 and 2 once a peak is generated in signal 1, and say if my program runs for 100 samples,and I want 10 intervals so I have 10 time bins, 0-10, 11-20 etc, and in each time bin, i would like to check to see if a peak occured in signal 1 AND signal 2, if so i record a 1. Now the tricky part is that I want to specify the time bins depending on signal 1, so that each time a peak occurs in Siganl 1 I have a new time bin?? is that possible? If not then I wil just try to do the first part of the histogram of recording the peaks of Signal 1 and 2.
You mentioned something about adding the two arrays. I use an index array for signal 1 and 2 seperately, which you will see in my block diagram, im a little confused about what you said with connecting them as an AND function. I will try to see if I can do that.
I have attached my VI, I use LabVIEW version 7.1
Thanks again
07-22-2005 09:47 AM
Hi, I just figured out how to construct a cross-correlogram, and it seems that I mis-understood how to do it.
Basically I want to choose a refrence signal, and one target signal....For my refrence signal I would like to pick the first peak or 1 as my reference `peak/spike`, and store that as time 0 on my histogram, then I want to record all the peaks of signal 2 into a histogram,. So if there are any peaks recorded for Signal 2 before the reference peak of the reference signal 1 they are stored in the negative axis of time so to the left of time 0. Once I have finished that I would like to take the next peak in the reference signal and use that as my new reference peak at time 0, therefore shifting my histogram once again, and again I search for peaks of the target signal and record them on to my histogram. and I would repeat this for however many refrence peaks I have.
I am very confused about how to implement this, as I have only been using labVIEW for 2 mths. I am assuming I will need a for loop that is controlled by the number of peaks of my reference signal. I dont know how to update the histogram though.
If anyone has any ideas I would greatly apprecitate them
thanks
07-22-2005 10:10 AM
sophie83 wrote:
Basically I want to choose a refrence signal, and one target signal....For my refrence signal I would like to pick the first peak or 1 as my reference `peak/spike`, and store that as time 0 on my histogram, then I want to record all the peaks of signal 2 into a histogram,. So if there are any peaks recorded for Signal 2 before the reference peak of the reference signal 1 they are stored in the negative axis of time so to the left of time 0. Once I have finished that I would like to take the next peak in the reference signal and use that as my new reference peak at time 0, therefore shifting my histogram once again, and again I search for peaks of the target signal and record them on to my histogram. and I would repeat this for however many refrence peaks I have.
That sounds to me like you want to take the peaks of signal 1 as boundaries for the bins of a histogram for signal 2 peaks. Or in other words: you want to count how many peaks of signal 2 occur between any two peaks of signal 1? Is that correct?
I could not open the VI you posted in your other mail since I only have LV 7.0. You can save your VI for LV 7.0 by using in the menu 'File->Save with Options->Save for Previous...' and then re-post it, so I can have a look.
-Franz
07-22-2005 10:39 AM
07-22-2005 01:22 PM
@sophie83 wrote:
Ok I saved it with version 7, but the problem is that it says you cant view some of my vis, like my source generator, so I dont think you`ll be abke to run it.
I can open the VI, but 'Advanced Peak Detector Pt by Pt.VI' is mising. Could you try to convert that also to LV 7.0 and post it?
@sophie83 wrote:
I think you misunderstood me, my message was not clear so sorry for that.What I want to do is say I have a signal A, and BSignal A only determines the x-axis, the Bin count or y axis is determined by signal B,so I find my first Peak let`s say called ``Peak 1`` for Signal A, and plot my histogram finding ALL peaks of signal B occuring AFTER the first reference peak of Signal A (Peak1). The peaks of Signal B are plotted normally on a histogram on the y axis( stores the number of peaks per time bin), then I will pick the next Peak of Signal A lets called it ``Peak 2`` and now that will be my new time 0 reference on the same histogram, so the plot is shifted to the left, and I need to find ALL peaks of Signal B occuring AFTER ``Peak 2``.I hope its clearer now
Sorry, not it is not yet clear to me. Maybe if I see the A and B data you try to evulate. If the posting should fail, you could try to export the data into a textfile and post it or you could take a screenshot of the data and post that.
-Franz
07-22-2005 01:43 PM - edited 07-22-2005 01:43 PM
Message Edited by sophie83 on 07-22-2005 01:55 PM
07-22-2005 03:30 PM