04-27-2013 03:02 PM - edited 04-27-2013 03:04 PM
Hello, allow me to thank you ahead of time for your help with this.
I am trying to figure out a method of taking a 2d array, and pulling out a specific section of that array based on numbers in one column. If it were excel, then I would, for example, be pulling rows 28-65. Specificaly, I want to pull all of the amplitudes associated with a range of frequencies. You can set theupper limit to be one frequency, and the lower limit to be a second frequency, and a subarray will be created based on an original array which contains the results for that specific range. For everything I have tried, the end result is an empty array. I will paste a link of my labview code below.
This program is to find the lev-mar best fit equation for the vibration amplitude based on freqency. It reads in data which has already been obtained. The only parts that I am working on is the best-fit vi, and it has to be run for each natural frequency position, which is why I am trying to build he array filter. If you see a better way to perform this function, feel free to point that out as well. Some of the code, for example the two arrays which show the result after the filter, are for me to be able to see the result while I am trying to make the filtering work.
Thank you again for your help.
Solved! Go to Solution.
04-27-2013 04:52 PM - edited 04-27-2013 04:54 PM
This shows you how to get a subset of all rows, where the number in the first column is between 400 and 500 (inclusive). The bottom for loop is how I'd do it before LV2012. If you have LV2012, I'd use the top loop.
The array functions I used, from left to right, are index array, replace array subset, and array subset.
04-27-2013 10:29 PM
This worked, thank you very much. However, do you see anything wrong with the way I have programmed in the best-fit vi? I am still getting the -20041 error, and I can't figure out why.
04-28-2013 11:46 AM - edited 04-28-2013 11:48 AM
@CStephens wrote:
This worked, thank you very much. However, do you see anything wrong with the way I have programmed in the best-fit vi? I am still getting the -20041 error, and I can't figure out why.
Can you:
04-28-2013 11:52 AM
Sure thing, data file is attached.
For best guesses, amplitude, a0 = 462.1, natural frequency, a1 = 328, and zeta, a2 = 0.05. Also, max and min frequency should be set to 340 and 300, respectively.
04-28-2013 12:16 PM - edited 04-28-2013 12:31 PM
Your formula is screwed up and only returns zeroes.
For troubleshooting, you should ALWAYS compute the function based on the guess parameters to see if the function looks reasonable. Currently, it does not.
(I typically use the VI model. What is the formula? Do you have a link to a website describing the theory?).
Here's a quick testbench.
04-28-2013 12:34 PM - edited 04-28-2013 12:35 PM
Basically, this is the equation that I am trying to input.
|FRF|=A/sqrt((w_n^2-w^2)^2+( 2*zeta_n*w_n*w)^2)
Where FRF = frequency response function and is the dependant variable, A is the amplitude at the natural frequency (constant), w_n is the natural frequency (constant), w is the frequency (independant variable), and zeta is the damping force (constant).
I used this model for the simple fact that I'm not sure how to use the VI model, and this method seemed to make more sense to me.
04-28-2013 12:44 PM - edited 04-28-2013 12:47 PM
Do you have a link describing the theory?
The fit will not work until you can generate a function using the best guess parameters that roughly has the features you expect. (a peak at a given position, etc.).
(I don't think you need the second "abs", because you are summing squared values)
In my earlier attachment I show how to use the model to calculate the result of your formula definition. Play around with it!
04-29-2013 12:26 AM