11-22-2012 08:46 PM
1. in my block diagram i have a clock showing number ''2'' http://i47.tinypic.com/2zxpoaf.jpg
in the daqassistance time settings i have continuous sample, samples to read 50, rate 2hz. this means it reads 50 samples in 0,025 seconds, but what about that the 2 in the block diagram?
2. this are the definitions of my labview right? but what about the NI board, it has some kind of settings like these related with time, or it is all defined in labview?
3. ''The sampling theorem states that the data should be sampled at a rate of at least 2 times greater than the highest frequency component in the signal being sampled.'' what is this ' highest frequency component' of my sample? how can i know it?
i know these are stupid questions but i am new in labview. i would be very grateful if you could help me somehow. thank you so much.
11-22-2012 09:34 PM
1. Please insert images directly into your post here. The little tree button allows you to select and insert an image.
1. a. That 2 is the number of milliseconds to Wait in the loop. If nothing else slows down the loop, that loop would run at 500 iterations per second.
1. b. While programming in LabVIEW, always keep the Context Help window visible. It will explain things like 1. a.
1. c. DAQ Assistant: Samples to read = number of samples it will accumulate (per channel) before returning the data.
Rate = how often it will take a sample.
1. d. For your values it will take 2 samples per second (one sample every 0.5 s) and will wait for 25 seconds before returning with 50 samples. Since 25 s >> 2 milliseconds, the Wait will be ignored.
2. The DAQ Assistant controls the driver for the DAQ board and passes the settings to the board.
3. The highest frequency component of your signal is determined by how fast the signal can change. You need to have some knowledge of your signals or of the device which porduces them to find the signal bandwidth. The frequency of any interferring signal or noise which is present at the input to the DAQ board must also be considered. Unless you tell us more about your signal source, we cannot even begin to guess what the sampling rate should be. If you signal has a complicated waveform or sharp edges, you may need to sample much faster than the Nyquist theorem would seem to indicate to reproduce the waveform well.
Lynn
11-23-2012 06:15 AM
oh my god thank you so much for your help.
please if you can tell me something about these doubts below i would be very grateful.
1d) Just to see if I understood, if the wait was 30seconds, we would wait 30 s for the 50 samples right?
but in some labview test, What is objective of the use of the ''wait in the loop''? (i understood that by my settings, it is not being used, i know).
3. This is about a laboratory equipment, for a gait experimental test. NI, transducers and force sensors are connected to 5vcc. Amplifiers to 24 vcc.
This is the excel file of an experiment: http://www.speedyshare.com/raxKu/a.xlsx
My input signal are the first 12 columns, the output the other 6 columns. the last column is time.
What can you tell me about an adequate sample rate for my experiment?
Also for the output data smoothing, I have to use a butterworth filter (in the output and then in the derivates of it) in matlab http://www.mathworks.com/help/signal/ref/butter.html. Is there anything you could tell me about the syntax I should use? i have never studied about filters and this seems so difficult...
sorry for the questions but i am really desperate with this work. anything you can tell me i appreciate very much. your answers were very clear to me. thank you so much for your kindness.
11-23-2012 10:13 AM
1d) Yes. The loop would run once every 30 seconds. If your data acquisition was set for contiuous acquisition, eventually the program will run out of memory because you are reading 25 seconds worth of data every 30 seconds.
The Wait is useful for timing a loop (approximately - the details can wait until you have a better understanding of LV) when nothing else in the loop is doing any timing. In your case the DAQ Assistant provides the timing so the Wait is not required. Waits are important when you have parallel loops because they allow the code to share processor resources. A loop without a Wait or other timing is sometimes called a greedy loop because it consumes all the availabel processor time.
3. It is better to attach your files directly to your post. Use the Attachments: Choose File button below the text box. Many people will not go to other sites to get a file for security concerns. Similarly, it is better to post a file like that as a tab-delimited text file or a .csv file. Again many people do not like to open files in formats which could contain hidden code.
According to your file you are sampling at .025 seconds or 40 Hz. This may be adequate for gait work. In looking at the data I do not see any obvious signs of aliasing. You may be losing some high frequency detail, for example in column 14.
Since you want to smooth the data anyway, you are probably OK.
The Butterworth Filter.vi on the Signal Processing >> Filters palette seems to work fine on your data. There are large transients due to the DC offset but that is easily fixed by subtracting the mean before filtering.
Lynn
11-24-2012 10:46 AM
hello,
i would like to ask you some new things.
1.do you think i can apply and it maked sense a cutoff frequency of 3 hz to my output (column 13, 14,15), and then to its derivates? i am using this value from a gait analysis article, since i don't have time to study this theme. the data i need to filter most is to column 15, and then the derivates that become very noisy.
3. so my f(s)/f(c)=40/(your_answer_to_question1) right? having this what option do you think i should choose from here http://www.mathworks.com/help/signal/ref/butter.html ???
2. so my sample frequecy is 40 hz, but i didn't get how this number is related to the ''samples to read=50 ; rate= 2hz'' of my labview. the first indicates 40 samples per second and the second 50 samples per 25 seconds. i can't understand this...
again thank you so much for your answers. i am learning so much with you. really hope that you can answer me. my professor does not understand nothing from this and wants me to write about this. this is for my thesis and so it is of major importance to me. anything helps. thank you so much for your huge kindness and knowlegde.
11-24-2012 12:03 PM
I have worked with professors and students who wanted the results of some analysis but did not understand the mathematics or the programming behind the analysis. It is important that you understand the principles of the analysis even if you do not know all the details. Someone on your examining committee might ask about it and if you publish your results, some reviewer likely will be knowledgeable about the topic.
The signal in the data you posted has a fundamental frequency of about 0.65 Hz (~6.5 cycles in 10 seconds). So filtering at 3 Hz means that you are eliminating most of the energy above the 5th harmonic. Column 9 has the highest harmonic energywith the second harmonic aprroximately equal to the fundamental. A three Hz cutoff makes very little difference visually in the waveforms. If that is the value used in the literature, you should probably stay with that unless you can justify a different value.
Taking the derivative after the filter definitely results in a less noisy derivative.
I do not understand your f(s)/f(c) question. What is f(c)? I have not worked with MATLAB enough to be abel to answer questions about the differences in their filters. My comments above are based on what I saw using LabVIEW filters.
The 40 Hz sample rate is based on the time column of the Excel file you posted. I do not know where you got that data or how the times were determined. If you have the DAQ Assistant set for a sample rate of 2 Hz, then you will get very different results. Two samples per second does not seem fast enough for gait work. Samples to Read has nothing to do with the sample rate, only how many samples you pull out of the buffer each time you do a Read.
Lynn
11-25-2012 01:41 PM
hi Lynn
sorry to bother but if you can't answer me to this new question i understand. it's just i am desperate and you are the only person 'i know' that can help me with this.
A)
what i meant with the other question
''2. so my sample frequecy is 40 hz, but i didn't get how this number is related to the ''samples to read=50 ; rate= 2hz'' of my labview. the first indicates 40 samples per second and the second 50 samples per 25 seconds. i can't understand this...''
you already check the excel and as you can see the labview image 'labv' in annex is like that. how does this can happen?
B)
my question about the fc is because of the file in excel, which objective is to find the ideal cutoff frequency. i studied this a lot this days and i am getting there but my result plot i can't understand. and the computation in excel is correct because i already repeated it one more time.
if you please could help me with something, even if it is just an opinion it is more that anyone have beemn doing for me. thank you so much. you can't imagine how you have been helping me and how this is important:) thank you.
11-25-2012 05:16 PM
A) When I look at the labv image I see that the sample rate is 2k = 2000, not 2 Hz. I am guessing a bit now, but the numbers work so this may be what is happening: The DAQ Assistant is sampling at 2000 samples per second. It is reading 50 samples at each read. 2000/50 = 40. So, reading 40 times per second matches the values in the Excel file. What I think may be happening (I cannot tell because I have not seen your program) is that you are reading data from the DAQ Assistant 40 times per second but only saving one point to the file for each reading rather than all fifty. If this is the case you are throwing away 98% of your data.
B) So fc is the cutoff frequency for your filter. The cutoff frequency has nothing to do with the file. The cutoff frequency should be related to the data and what information you want to get out of it. Earlier you mentioned that others have used 3 Hz. Unless you have good physical reasons for changing to a different cutoff, I suggest you stay with what has been reported by the others. Just because someone else used that value, does not mean that it is the best value, but you will need to explain why your value is better if you use something different. From the questions you are asking, I do not think you have enough understanding of signal processing to make an informed judgement on the filter.
Lynn
11-27-2012 03:23 AM
hello
thank you so much for your clear answers. i have been working on this. i wanted to ask you:
in what refers to a) what is the correct thing to happen. save 100% of my data? and so have a sample rate like 50 hz and read 50 and so have 1 hz? i think no, for what i have been reading but i cant really understand this 98%, that also seems to much for me.
thank you so much for all your kindness. hope you can answer me.
11-27-2012 06:38 AM
I am not sure what is happening in your program because you have only showed images of small portions of it. It also seems that you are not sure what you want to do with the data. The combination of those two uncertainties makes it impossible to give you any good advice.
To try to explain what I was talking about in A) above, let me create a hypothetical example.
1. I am assuming that the image you showed of the DAQ Assistant configuration screen is correct: Sample rate = 2 kHz = 2000 samples per second, Samples to Read = 50 (meaning that each time the DAQ Assistant is called it will return 50 samples per channel), continuous acquisistion mode, and 12 channels.
2. I am assuming that the Excel file has accurate timestamps and that only one data point per channel is recorded in that file (a.xlsx).
3. I am guessing about what happened. But the guess is supported by the calculations.
The DAQ Assistant probably returns a Dynamic Data Type called Signals, or something similar. {The Dynamic Data Type (DDT) is (in my opinion) an evil construct intended to hide the structure of the data and to make it difficult to determine what is in there.} It probably contains an array of waveforms with one waveform per channel and each waveform contains an array with 50 data points (and other information). It retuns this amount of data on every iteration of the loop. In the process of converting the DDT to a format suitable for saving to Excel only one data point is save from each waveform, probably the first element, but possibly the last or even an average of all fifty. This is one of my guesses because I have not seen that part of the code. So the program saves to file one data point for every 50 data points the DAQ Assistant acquired. 49 of 50 = 98% = the fraction of the data which is not saved.
Whether you should save all the data or what you should do with it is dependent entirely on the nature of your project and what is appropriate for that. You have mentioned a gait study but I cannot effectively advise you on what you need to do because I do not have the expertise in that field. Some of the remarks I made about filters were based on the way the signals look but no on what they mean.
Lynn